mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Update CSS tests to revision 0698c2aa9ead844b6d7d10eafb096cb1118e13ef
This commit is contained in:
parent
9aa1b1e408
commit
35c74aecc2
11290 changed files with 92400 additions and 49214 deletions
|
@ -39,10 +39,10 @@
|
|||
var outer = document.getElementById("outside");
|
||||
var inner = document.getElementById("inside");
|
||||
var innerStyle;
|
||||
|
||||
|
||||
test(function() {
|
||||
innerStyle = window.getComputedStyle(inner);
|
||||
assert_throws( "NO_MODIFICATION_ALLOWED_ERR",
|
||||
assert_throws( "NO_MODIFICATION_ALLOWED_ERR",
|
||||
function() { innerStyle.cssText = "color: blue;"; },
|
||||
"do not allow setting cssText on a readonly CSSStyleDeclaration");
|
||||
assert_throws( "NO_MODIFICATION_ALLOWED_ERR",
|
||||
|
@ -51,10 +51,10 @@
|
|||
assert_throws( "NO_MODIFICATION_ALLOWED_ERR",
|
||||
function() { innerStyle.color = "blue"; },
|
||||
"do not allow setting a property on a readonly CSSStyleDeclaration");
|
||||
}, "read_only", {
|
||||
}, "read_only", {
|
||||
assert: "do not allow modifications to a computed CSSStyleDeclaration"
|
||||
});
|
||||
|
||||
|
||||
test(function() {
|
||||
assert_equals(innerStyle.getPropertyValue("height"), "100px");
|
||||
}, "property_values", {
|
||||
|
@ -66,7 +66,7 @@
|
|||
}, "inherited_property_values", {
|
||||
assert: "Inherited properties are resolved"
|
||||
});
|
||||
|
||||
|
||||
test(function() {
|
||||
assert_equals(innerStyle.getPropertyValue("width"), "100px");
|
||||
}, "relative_property_values", {
|
||||
|
|
|
@ -10,87 +10,54 @@
|
|||
<style id="styleElement">
|
||||
#test { color: green; }
|
||||
</style>
|
||||
<script id="metadata_cache">/*
|
||||
{
|
||||
"CSSStyleDeclaration_accessible": {
|
||||
"help": ["http://www.w3.org/TR/cssom/#the-cssstylesheet-interface",
|
||||
"http://www.w3.org/TR/cssom/#the-cssrulelist-interface",
|
||||
"http://www.w3.org/TR/cssom/#the-cssstylerule-interface"],
|
||||
"assert": "Can access CSSStyleDeclaration through CSSOM"
|
||||
},
|
||||
"read": { "assert": "initial property values are correct" },
|
||||
"csstext_write": {
|
||||
"assert": ["setting cssText adds new properties",
|
||||
"setting cssText removes existing properties",
|
||||
"properties set through cssText are reflected in the computed style"]
|
||||
},
|
||||
"property_write": {
|
||||
"assert": ["setProperty adds new properties",
|
||||
"properties set through setProperty are reflected in the computed style"]
|
||||
}
|
||||
}
|
||||
*/</script>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>Test not run - javascript required.</noscript>
|
||||
<div id="log"></div>
|
||||
<div id="test"></div>
|
||||
<script type="text/javascript">
|
||||
var styleElement = document.getElementById("styleElement");
|
||||
var styleDeclaration;
|
||||
test(function() {
|
||||
assert_own_property(styleElement, "sheet");
|
||||
assert_own_property(styleElement.sheet, "cssRules");
|
||||
assert_true(styleElement.sheet.cssRules instanceof CSSRuleList);
|
||||
assert_true(styleElement.sheet.cssRules.item(0) instanceof CSSStyleRule);
|
||||
declaration = styleElement.sheet.cssRules.item(0).style;
|
||||
}, "CSSStyleDeclaration_accessible",
|
||||
{ help: [ "http://www.w3.org/TR/cssom/#the-cssstylesheet-interface",
|
||||
"http://www.w3.org/TR/cssom/#the-cssrulelist-interface",
|
||||
"http://www.w3.org/TR/cssom/#the-cssstylerule-interface" ],
|
||||
assert: "Can access CSSStyleDeclaration through CSSOM" });
|
||||
var declaration;
|
||||
setup(function() {
|
||||
var styleElement = document.getElementById("styleElement");
|
||||
declaration = styleElement.sheet.cssRules.item(0).style;
|
||||
});
|
||||
|
||||
test(function() {
|
||||
assert_regexp_match(declaration.cssText, /color: green;\s*/);
|
||||
test(function() {
|
||||
assert_equals(declaration.cssText, "color: green;");
|
||||
assert_equals(declaration.getPropertyValue("color"), "green");
|
||||
}, "read",
|
||||
{ assert: "initial property values are correct" });
|
||||
}, "Reading CSSStyleDeclaration initialized from a style element");
|
||||
|
||||
test(function() {
|
||||
declaration.cssText = "margin-left: 10px; padding-left: 10px;";
|
||||
assert_regexp_match(declaration.cssText, /margin-left: 10px;\s+padding-left: 10px;\s+/);
|
||||
declaration.cssText = "margin-left:10px; padding-left:10px";
|
||||
assert_equals(declaration.cssText, "margin-left: 10px; padding-left: 10px;");
|
||||
assert_equals(declaration.length, 2);
|
||||
assert_equals(declaration.item(0), "margin-left");
|
||||
assert_equals(declaration.item(1), "padding-left");
|
||||
assert_equals(declaration.getPropertyValue("margin-left"), "10px");
|
||||
assert_equals(declaration.getPropertyValue("padding-left"), "10px");
|
||||
|
||||
|
||||
var computedStyle = window.getComputedStyle(document.getElementById("test"));
|
||||
assert_equals(computedStyle.getPropertyValue("margin-left"), "10px");
|
||||
assert_equals(computedStyle.getPropertyValue("padding-left"), "10px");
|
||||
}, "csstext_write",
|
||||
{ assert: [ "setting cssText adds new properties",
|
||||
"setting cssText removes existing properties",
|
||||
"properties set through cssText are reflected in the computed style"] });
|
||||
}, "Setting CSSStyleDeclaration#cssText");
|
||||
|
||||
test(function() {
|
||||
while(declaration.length > 0)
|
||||
while (declaration.length > 0) {
|
||||
declaration.removeProperty(declaration.item(0));
|
||||
}
|
||||
declaration.setProperty("margin-left", "15px");
|
||||
declaration.setProperty("padding-left", "15px");
|
||||
|
||||
|
||||
assert_equals(declaration.length, 2);
|
||||
assert_equals(declaration.item(0), "margin-left");
|
||||
assert_equals(declaration.item(1), "padding-left");
|
||||
assert_equals(declaration.getPropertyValue("margin-left"), "15px");
|
||||
assert_equals(declaration.getPropertyValue("padding-left"), "15px");
|
||||
|
||||
|
||||
var computedStyle = window.getComputedStyle(document.getElementById("test"));
|
||||
assert_equals(computedStyle.getPropertyValue("margin-left"), "15px");
|
||||
assert_equals(computedStyle.getPropertyValue("padding-left"), "15px");
|
||||
}, "property_write",
|
||||
{ assert: [ "setProperty adds new properties",
|
||||
"properties set through setProperty are reflected in the computed style"] });
|
||||
}, "Calling CSSStyleDeclaration#setProperty");
|
||||
</script>
|
||||
|
||||
|
||||
</body></html>
|
|
@ -6,51 +6,33 @@
|
|||
<link href="http://www.w3.org/TR/cssom/#the-cssrule-interface" rel="help">
|
||||
<link href="http://www.w3.org/TR/cssom/#the-cssimportrule-interface" rel="help">
|
||||
<meta content="dom" name="flags">
|
||||
<meta content="All properties for this CSSImportRule instance of CSSRule are initialized correctly" name="assert">
|
||||
<meta content="All properties for this CSSImportRule instance of CSSRule are initialized correctly" name="assert">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
|
||||
<style type="text/css" id="styleElement">
|
||||
@import url("support/a-green.css");
|
||||
@import url("support/a-green.css") screen;
|
||||
</style>
|
||||
|
||||
<script id="metadata_cache">/*
|
||||
{
|
||||
"CSSRule and CSSImportRule types": { "assert": "rule is an instance of CSSRule and CSSImportRule" },
|
||||
"Rule_type_property": { "assert": "CSSRule type property has correct type and constants" },
|
||||
"CSSRule_properties": {
|
||||
"assert": ["cssText, parentRule, parentStyleSheet properties exist on CSSRule",
|
||||
"type, parentRule, parentStyleSheet properties on CSSRule are readonly"]
|
||||
},
|
||||
"CSSRule_properties_values": { "assert": "type, parentRule, parentStyleSheet initial property values on CSSRule are correct" },
|
||||
"CSSImportRule_properties": {
|
||||
"assert": ["href, media, styleSheet properties exist on CSSImportsRule",
|
||||
"href, media, styleSheet properties are readonly"]
|
||||
},
|
||||
"CSSImportRule_properties_values": { "assert": "Initial values of href, media, styleSheet properties on CSSImportRule are correct" }
|
||||
}
|
||||
*/</script>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>Test not run -- JavaScript required.</noscript>
|
||||
<div id="log"></div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var styleSheet = document.getElementById("styleElement").sheet;
|
||||
var ruleList = styleSheet.cssRules;
|
||||
|
||||
var rule = ruleList[0];
|
||||
var ruleWithMedia = ruleList[1];
|
||||
var rule, ruleWithMedia;
|
||||
setup(function() {
|
||||
var styleSheet = document.getElementById("styleElement").sheet;
|
||||
var ruleList = styleSheet.cssRules;
|
||||
rule = ruleList[0];
|
||||
ruleWithMedia = ruleList[1];
|
||||
});
|
||||
|
||||
test(function() {
|
||||
assert_true(rule instanceof CSSRule);
|
||||
assert_true(rule instanceof CSSImportRule);
|
||||
assert_true(ruleWithMedia instanceof CSSRule);
|
||||
assert_true(ruleWithMedia instanceof CSSImportRule);
|
||||
}, "CSSRule and CSSImportRule types",
|
||||
{ assert: "rule is an instance of CSSRule and CSSImportRule" }
|
||||
);
|
||||
}, "CSSRule and CSSImportRule types");
|
||||
|
||||
test(function() {
|
||||
assert_equals(rule.STYLE_RULE, 1);
|
||||
|
@ -59,47 +41,39 @@
|
|||
assert_equals(rule.FONT_FACE_RULE, 5);
|
||||
assert_equals(rule.PAGE_RULE, 6);
|
||||
assert_equals(rule.NAMESPACE_RULE, 10);
|
||||
assert_own_property(rule, "type");
|
||||
assert_true(typeof rule.type === "number");
|
||||
}, "Rule_type_property",
|
||||
{ assert: "CSSRule type property has correct type and constants" }
|
||||
);
|
||||
assert_idl_attribute(rule, "type");
|
||||
assert_equals(typeof rule.type, "number");
|
||||
}, "Type of CSSRule#type and constant values");
|
||||
|
||||
test(function() {
|
||||
assert_true(rule instanceof CSSRule);
|
||||
assert_own_property(rule, "cssText");
|
||||
assert_own_property(rule, "parentRule");
|
||||
assert_own_property(rule, "parentStyleSheet");
|
||||
assert_idl_attribute(rule, "cssText");
|
||||
assert_idl_attribute(rule, "parentRule");
|
||||
assert_idl_attribute(rule, "parentStyleSheet");
|
||||
|
||||
assert_readonly(rule, "type");
|
||||
assert_readonly(rule, "parentRule");
|
||||
assert_readonly(rule, "parentStyleSheet");
|
||||
}, "CSSRule_properties",
|
||||
{ assert: ["cssText, parentRule, parentStyleSheet properties exist on CSSRule", "type, parentRule, parentStyleSheet properties on CSSRule are readonly"] }
|
||||
);
|
||||
}, "Existence and writability of CSSRule attributes");
|
||||
|
||||
test(function() {
|
||||
assert_equals(rule.type, rule.IMPORT_RULE);
|
||||
assert_equals(typeof rule.cssText, "string");
|
||||
assert_equals(rule.cssText, "@import url(\"cssimportrule.css\");");
|
||||
assert_equals(ruleWithMedia.cssText, "@import url(\"cssimportrule.css\") screen;");
|
||||
assert_equals(rule.cssText, '@import url("support/a-green.css");');
|
||||
assert_equals(ruleWithMedia.cssText, '@import url("support/a-green.css") screen;');
|
||||
assert_equals(rule.parentRule, null);
|
||||
assert_true(rule.parentStyleSheet instanceof CSSStyleSheet);
|
||||
}, "CSSRule_properties_values",
|
||||
{ assert: "type, parentRule, parentStyleSheet initial property values on CSSRule are correct" }
|
||||
);
|
||||
}, "Values of CSSRule attributes");
|
||||
|
||||
test(function() {
|
||||
assert_own_property(rule, "href");
|
||||
assert_own_property(rule, "media");
|
||||
assert_own_property(rule, "styleSheet");
|
||||
assert_idl_attribute(rule, "href");
|
||||
assert_idl_attribute(rule, "media");
|
||||
assert_idl_attribute(rule, "styleSheet");
|
||||
|
||||
assert_readonly(rule, "href");
|
||||
assert_readonly(rule, "media");
|
||||
assert_readonly(rule, "styleSheet");
|
||||
}, "CSSImportRule_properties",
|
||||
{ assert: ["href, media, styleSheet properties exist on CSSImportsRule", "href, media, styleSheet properties are readonly"] }
|
||||
);
|
||||
}, "Existence and writability of CSSImportRule attributes");
|
||||
|
||||
test(function() {
|
||||
assert_equals(typeof rule.href, "string");
|
||||
|
@ -107,10 +81,7 @@
|
|||
assert_true(rule.styleSheet instanceof CSSStyleSheet);
|
||||
assert_true(ruleWithMedia.media.length > 0);
|
||||
assert_equals(ruleWithMedia.media.mediaText, "screen");
|
||||
}, "CSSImportRule_properties_values",
|
||||
{ assert: "Initial values of href, media, styleSheet properties on CSSImportRule are correct" }
|
||||
);
|
||||
|
||||
}, "Values of CSSImportRule attributes");
|
||||
</script>
|
||||
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
test(function(){
|
||||
var e = newElm();
|
||||
var style = e.style;
|
||||
|
||||
|
||||
style.color = 'red';
|
||||
style.fontSize = '10pt';
|
||||
style.fontWeight = 'bold';
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<link href="http://www.w3.org/TR/cssom/#the-cssrule-interface" rel="help">
|
||||
<link href="http://www.w3.org/TR/cssom/#the-cssstylerule-interface" rel="help">
|
||||
<meta content="dom" name="flags">
|
||||
<meta content="All properties for this CSSStyleRule instance of CSSRule are initialized correctly" name="assert">
|
||||
<meta content="All properties for this CSSStyleRule instance of CSSRule are initialized correctly" name="assert">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
|
|
|
@ -19,12 +19,19 @@ test(function() {
|
|||
}, "String conversion");
|
||||
|
||||
test(function() {
|
||||
assert_throws('InvalidCharacterError', function() { CSS.escape('\0'); });
|
||||
assert_throws('InvalidCharacterError', function() { CSS.escape('a\0'); });
|
||||
assert_throws('InvalidCharacterError', function() { CSS.escape('\0b'); });
|
||||
assert_throws('InvalidCharacterError', function() { CSS.escape('a\0b'); });
|
||||
assert_equals(CSS.escape('\0'), '\uFFFD');
|
||||
assert_equals(CSS.escape('a\0'), 'a\uFFFD');
|
||||
assert_equals(CSS.escape('\0b'), '\uFFFDb');
|
||||
assert_equals(CSS.escape('a\0b'), 'a\uFFFDb');
|
||||
}, "Null bytes");
|
||||
|
||||
test(function() {
|
||||
assert_equals(CSS.escape('\uFFFD'), '\uFFFD');
|
||||
assert_equals(CSS.escape('a\uFFFD'), 'a\uFFFD');
|
||||
assert_equals(CSS.escape('\uFFFDb'), '\uFFFDb');
|
||||
assert_equals(CSS.escape('a\uFFFDb'), 'a\uFFFDb');
|
||||
}, "Replacement character");
|
||||
|
||||
test(function() {
|
||||
assert_equals(CSS.escape('0a'), '\\30 a');
|
||||
assert_equals(CSS.escape('1a'), '\\31 a');
|
||||
|
|
|
@ -7,13 +7,13 @@
|
|||
<meta content="The style value should be serialized to margin: 20px;" name="assert">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
</head>
|
||||
<body>
|
||||
<div id="cssomtestElm"></div>
|
||||
<div id="log"></div>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var testElm = document.getElementById('cssomtestElm');
|
||||
// Set the transform
|
||||
// Set the transform
|
||||
document.getElementById('cssomtestElm').style.margin = "20px 20px 20px 20px";
|
||||
|
||||
// Verify that the transform was set as expected
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
<meta content="Testing Serialization of Shorthand Values" name="assert">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
</head>
|
||||
<body>
|
||||
<div id="cssomtestElm"></div>
|
||||
<div id="log"></div>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var tests = {
|
||||
'border': [
|
||||
|
@ -56,26 +56,26 @@
|
|||
|
||||
var testElm = document.getElementById('cssomtestElm');
|
||||
for (var test in tests) {
|
||||
|
||||
|
||||
console.log(test);
|
||||
|
||||
if(tests.hasOwnProperty(test)) {
|
||||
results[test] = [];
|
||||
results[test] = [];
|
||||
var propertyTests = tests[test];
|
||||
|
||||
|
||||
for (i = 0; i < propertyTests.length; i++) {
|
||||
document.getElementById('cssomtestElm').setAttribute('style', propertyTests[i][0]);
|
||||
results[test].push([
|
||||
test + ' is expected to be ' + propertyTests[i][1],
|
||||
test + ' is expected to be ' + propertyTests[i][1],
|
||||
document.getElementById('cssomtestElm').style.cssText,
|
||||
propertyTests[i][1]
|
||||
]);
|
||||
}
|
||||
|
||||
generate_tests(assert_equals, results[test]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
|
|
@ -8,17 +8,17 @@
|
|||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<style id="s-0">
|
||||
@namespace svg "http://www.w3.org/2000/svg";
|
||||
@namespace svg "http://www.w3.org/2000/svg";
|
||||
</style>
|
||||
<style id="s-1">
|
||||
@import url('main.css');
|
||||
@import url('main.css');
|
||||
</style>
|
||||
<style id="s-2">
|
||||
<style id="s-2">
|
||||
h1 { background: indianred; }
|
||||
</style>
|
||||
</style>
|
||||
<style id="s-3">
|
||||
@namespace svg "http://www.w3.org/2000/svg";
|
||||
svg|a { color: white; }
|
||||
@namespace svg "http://www.w3.org/2000/svg";
|
||||
svg|a { color: white; }
|
||||
</style>
|
||||
<style id="s-4">
|
||||
@font-face {
|
||||
|
@ -30,7 +30,7 @@
|
|||
url('fonts/megalopolisextra-webfont.svg#MEgalopolisExtraRegular') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<style id="s-5">
|
||||
@media (min-width: 200px) {
|
||||
|
@ -42,14 +42,14 @@
|
|||
h1 { color: #444; }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var stylesheets = document.styleSheets;
|
||||
var ruletypes = {
|
||||
1: 'Style Rule',
|
||||
3: '@import rule',
|
||||
3: '@import rule',
|
||||
4: 'media rule',
|
||||
5: '@font-face rule',
|
||||
6: 'page rule',
|
||||
|
@ -67,28 +67,28 @@
|
|||
's-6': '@page :first'
|
||||
}
|
||||
|
||||
var ruleOrder = [10, 3, 1, 1, 5, 4, 6];
|
||||
var ruleOrder = [10, 3, 1, 1, 5, 4, 6];
|
||||
|
||||
var results = [];
|
||||
|
||||
|
||||
for (i = 0; i < stylesheets.length; i++) {
|
||||
|
||||
for (i = 0; i < stylesheets.length; i++) {
|
||||
if(i == 3) {
|
||||
cssType = stylesheets[i].cssRules.length > 0 && stylesheets[i].cssRules[1] ? stylesheets[i].cssRules[1].type : 11;
|
||||
cssType = stylesheets[i].cssRules.length > 0 && stylesheets[i].cssRules[1] ? stylesheets[i].cssRules[1].type : 11;
|
||||
} else {
|
||||
cssType = stylesheets[i].cssRules.length > 0 ? stylesheets[i].cssRules[0].type : 11;
|
||||
cssType = stylesheets[i].cssRules.length > 0 ? stylesheets[i].cssRules[0].type : 11;
|
||||
}
|
||||
|
||||
|
||||
results.push([
|
||||
ruletypes[ruleOrder[i]] + ' is expected to be ' + types['s-' + i],
|
||||
ruletypes[cssType],
|
||||
ruletypes[ruleOrder[i]]
|
||||
]);
|
||||
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
generate_tests(assert_equals, results);
|
||||
|
||||
generate_tests(assert_equals, results);
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
|
|
@ -41,8 +41,8 @@
|
|||
test(function() {
|
||||
assert_regexp_match(declaration.cssText, /margin-left: 5px;\s*/);
|
||||
assert_equals(declaration.getPropertyValue("margin-left"), "5px");
|
||||
}, "read", {
|
||||
assert: "initial property values are correct"
|
||||
}, "read", {
|
||||
assert: "initial property values are correct"
|
||||
});
|
||||
|
||||
test(function() {
|
||||
|
@ -53,14 +53,14 @@
|
|||
assert_equals(declaration.item(1), "padding-left");
|
||||
assert_equals(declaration.getPropertyValue("margin-left"), "10px");
|
||||
assert_equals(declaration.getPropertyValue("padding-left"), "10px");
|
||||
|
||||
|
||||
var computedStyle = window.getComputedStyle(document.getElementById("test"));
|
||||
assert_equals(computedStyle.getPropertyValue("margin-left"), "10px");
|
||||
assert_equals(computedStyle.getPropertyValue("padding-left"), "10px");
|
||||
}, "csstext_write", {
|
||||
}, "csstext_write", {
|
||||
assert: [ "setting cssText adds new properties",
|
||||
"setting cssText removes existing properties",
|
||||
"properties set through cssText are reflected in the computed style"]
|
||||
"properties set through cssText are reflected in the computed style"]
|
||||
});
|
||||
|
||||
test(function() {
|
||||
|
@ -68,19 +68,19 @@
|
|||
declaration.removeProperty(declaration.item(0));
|
||||
declaration.setProperty("margin-left", "15px");
|
||||
declaration.setProperty("padding-left", "15px");
|
||||
|
||||
|
||||
assert_equals(declaration.length, 2);
|
||||
assert_equals(declaration.item(0), "margin-left");
|
||||
assert_equals(declaration.item(1), "padding-left");
|
||||
assert_equals(declaration.getPropertyValue("margin-left"), "15px");
|
||||
assert_equals(declaration.getPropertyValue("padding-left"), "15px");
|
||||
|
||||
|
||||
var computedStyle = window.getComputedStyle(document.getElementById("test"));
|
||||
assert_equals(computedStyle.getPropertyValue("margin-left"), "15px");
|
||||
assert_equals(computedStyle.getPropertyValue("padding-left"), "15px");
|
||||
}, "property_write", {
|
||||
assert: [ "setProperty adds new properties",
|
||||
"properties set through setProperty are reflected in the computed style"]
|
||||
}, "property_write", {
|
||||
assert: [ "setProperty adds new properties",
|
||||
"properties set through setProperty are reflected in the computed style"]
|
||||
});
|
||||
|
||||
test(function() {
|
||||
|
@ -96,4 +96,5 @@
|
|||
});
|
||||
</script>
|
||||
|
||||
|
||||
</body></html>
|
163
tests/wpt/css-tests/cssom-1_dev/html/interfaces.htm
Normal file
163
tests/wpt/css-tests/cssom-1_dev/html/interfaces.htm
Normal file
|
@ -0,0 +1,163 @@
|
|||
<!DOCTYPE html>
|
||||
<html><head><meta charset="utf-8">
|
||||
<title>CSSOM automated IDL tests</title>
|
||||
<link href="mailto:Ms2ger@gmail.com" rel="author" title="Ms2ger">
|
||||
<link href="https://drafts.csswg.org/cssom-1/#idl-index" rel="help">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/resources/WebIDLParser.js"></script>
|
||||
<script src="/resources/idlharness.js"></script>
|
||||
<style id="styleElement">
|
||||
#test { color: green; }
|
||||
</style>
|
||||
</head><body><div id="log"></div>
|
||||
<script type="text/plain" id="untested_idl">
|
||||
interface EventTarget {};
|
||||
interface Node : EventTarget {};
|
||||
interface Document : Node {};
|
||||
interface ProcessingInstruction : Node {};
|
||||
interface Element : Node {};
|
||||
interface HTMLElement : Element {};
|
||||
interface SVGElement : Element {};
|
||||
[PrimaryGlobal] interface Window {};
|
||||
</script>
|
||||
<script type="text/plain" id="idl">
|
||||
[ArrayClass]interface MediaList {
|
||||
[TreatNullAs=EmptyString] stringifier attribute DOMString mediaText;
|
||||
readonly attribute unsigned long length;
|
||||
getter DOMString? item(unsigned long index);
|
||||
void appendMedium(DOMString medium);
|
||||
void deleteMedium(DOMString medium);
|
||||
};
|
||||
interface StyleSheet {
|
||||
readonly attribute DOMString type;
|
||||
readonly attribute DOMString? href;
|
||||
readonly attribute (Element or ProcessingInstruction)? ownerNode;
|
||||
readonly attribute StyleSheet? parentStyleSheet;
|
||||
readonly attribute DOMString? title;
|
||||
[SameObject, PutForwards=mediaText] readonly attribute MediaList media;
|
||||
attribute boolean disabled;
|
||||
};
|
||||
|
||||
interface CSSStyleSheet : StyleSheet {
|
||||
readonly attribute CSSRule? ownerRule;
|
||||
[SameObject] readonly attribute CSSRuleList cssRules;
|
||||
unsigned long insertRule(DOMString rule, unsigned long index);
|
||||
void deleteRule(unsigned long index);
|
||||
};
|
||||
|
||||
[ArrayClass]interface StyleSheetList {
|
||||
getter StyleSheet? item(unsigned long index);
|
||||
readonly attribute unsigned long length;
|
||||
};
|
||||
partial interface Document { [SameObject] readonly attribute StyleSheetList styleSheets;
|
||||
attribute DOMString? selectedStyleSheetSet;
|
||||
readonly attribute DOMString? lastStyleSheetSet;
|
||||
readonly attribute DOMString? preferredStyleSheetSet;
|
||||
readonly attribute DOMString[] styleSheetSets;
|
||||
void enableStyleSheetsForSet(DOMString? name);
|
||||
};
|
||||
[NoInterfaceObject]interface LinkStyle {
|
||||
readonly attribute StyleSheet? sheet;
|
||||
};
|
||||
ProcessingInstruction implements LinkStyle;
|
||||
[ArrayClass]interface CSSRuleList {
|
||||
getter CSSRule? item(unsigned long index);
|
||||
readonly attribute unsigned long length;
|
||||
};
|
||||
interface CSSRule { const unsigned short STYLE_RULE = 1;
|
||||
const unsigned short CHARSET_RULE = 2; // historical
|
||||
const unsigned short IMPORT_RULE = 3;
|
||||
const unsigned short MEDIA_RULE = 4;
|
||||
const unsigned short FONT_FACE_RULE = 5;
|
||||
const unsigned short PAGE_RULE = 6;
|
||||
const unsigned short MARGIN_RULE = 9;
|
||||
const unsigned short NAMESPACE_RULE = 10;
|
||||
readonly attribute unsigned short type;
|
||||
attribute DOMString cssText;
|
||||
readonly attribute CSSRule? parentRule;
|
||||
readonly attribute CSSStyleSheet? parentStyleSheet;
|
||||
};
|
||||
interface CSSStyleRule : CSSRule { attribute DOMString selectorText;
|
||||
[SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style;
|
||||
};
|
||||
interface CSSImportRule : CSSRule { readonly attribute DOMString href;
|
||||
[SameObject, PutForwards=mediaText] readonly attribute MediaList media;
|
||||
[SameObject] readonly attribute CSSStyleSheet styleSheet;
|
||||
};
|
||||
interface CSSGroupingRule : CSSRule { [SameObject] readonly attribute CSSRuleList cssRules;
|
||||
unsigned long insertRule(DOMString rule, unsigned long index);
|
||||
void deleteRule(unsigned long index);
|
||||
};
|
||||
interface CSSMediaRule : CSSGroupingRule { [SameObject, PutForwards=mediaText] readonly attribute MediaList media;
|
||||
};
|
||||
interface CSSPageRule : CSSGroupingRule { attribute DOMString selectorText;
|
||||
[SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style;
|
||||
};
|
||||
interface CSSMarginRule : CSSRule { readonly attribute DOMString name;
|
||||
[SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style;
|
||||
};
|
||||
interface CSSNamespaceRule : CSSRule { readonly attribute DOMString namespaceURI;
|
||||
readonly attribute DOMString prefix;
|
||||
};
|
||||
interface CSSStyleDeclaration { attribute DOMString cssText;
|
||||
readonly attribute unsigned long length;
|
||||
getter DOMString item(unsigned long index);
|
||||
DOMString getPropertyValue(DOMString property);
|
||||
DOMString getPropertyPriority(DOMString property);
|
||||
void setProperty(DOMString property, [TreatNullAs=EmptyString] DOMString value, [TreatNullAs=EmptyString] optional DOMString priority = "");
|
||||
void setPropertyValue(DOMString property, [TreatNullAs=EmptyString] DOMString value);
|
||||
void setPropertyPriority(DOMString property, [TreatNullAs=EmptyString] DOMString priority);
|
||||
DOMString removeProperty(DOMString property);
|
||||
readonly attribute CSSRule? parentRule;
|
||||
[TreatNullAs=EmptyString] attribute DOMString cssFloat;
|
||||
};
|
||||
partial interface CSSStyleDeclaration { [TreatNullAs=EmptyString] attribute DOMString _camel_cased_attribute;
|
||||
};
|
||||
partial interface CSSStyleDeclaration { [TreatNullAs=EmptyString] attribute DOMString _dashed_attribute;
|
||||
};
|
||||
[NoInterfaceObject]interface ElementCSSInlineStyle {
|
||||
[SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style;
|
||||
};
|
||||
HTMLElement implements ElementCSSInlineStyle;
|
||||
SVGElement implements ElementCSSInlineStyle;
|
||||
partial interface Window { [NewObject] CSSStyleDeclaration getComputedStyle(Element elt, optional DOMString? pseudoElt);
|
||||
};
|
||||
[NoInterfaceObject]interface GetStyleUtils {
|
||||
[SameObject] readonly attribute CSSStyleDeclaration cascadedStyle;
|
||||
[SameObject] readonly attribute CSSStyleDeclaration defaultStyle;
|
||||
[SameObject] readonly attribute CSSStyleDeclaration rawComputedStyle;
|
||||
[SameObject] readonly attribute CSSStyleDeclaration usedStyle;
|
||||
};
|
||||
partial interface Element { PseudoElement? pseudo(DOMString pseudoElt);
|
||||
};
|
||||
|
||||
Element implements GetStyleUtils;
|
||||
interface PseudoElement {
|
||||
};
|
||||
|
||||
PseudoElement implements GetStyleUtils;
|
||||
interface CSS { static DOMString escape(DOMString ident);
|
||||
};
|
||||
</script>
|
||||
<script>
|
||||
var idl_array, style_element;
|
||||
setup(function() {
|
||||
idl_array = new IdlArray();
|
||||
var idls = document.getElementById("idl").textContent;
|
||||
var untested_idls = document.getElementById("untested_idl").textContent;
|
||||
idl_array.add_untested_idls(untested_idls);
|
||||
idl_array.add_idls(idls);
|
||||
|
||||
style_element = document.getElementById('styleElement');
|
||||
idl_array.add_objects({
|
||||
"Document": ["document", "new Document()"],
|
||||
"StyleSheetList": ["document.styleSheets"],
|
||||
"CSSStyleSheet": ["style_element.sheet"],
|
||||
"CSSRuleList": ["style_element.sheet.cssRules"],
|
||||
"CSSStyleRule": ["style_element.sheet.cssRules[0]"],
|
||||
});
|
||||
});
|
||||
idl_array.test();
|
||||
</script>
|
||||
</body></html>
|
|
@ -37,15 +37,15 @@
|
|||
<noscript>Test not run - javascript required.</noscript>
|
||||
<div id="log"></div>
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
var styleElement;
|
||||
var styleSheet;
|
||||
var mediaList;
|
||||
|
||||
|
||||
// Setup
|
||||
function setup() {
|
||||
styleElement = document.getElementById("styleElement");
|
||||
|
||||
|
||||
if (styleElement) {
|
||||
// teardown
|
||||
document.getElementsByTagName("head")[0].removeChild(styleElement);
|
||||
|
@ -53,57 +53,58 @@
|
|||
styleSheet = undefined;
|
||||
mediaList = undefined;
|
||||
}
|
||||
|
||||
|
||||
styleElement = document.createElement("style");
|
||||
styleElement.id = "styleElement";
|
||||
styleElement.type = "text/css";
|
||||
styleElement.media = "all";
|
||||
document.getElementsByTagName("head")[0].appendChild(styleElement);
|
||||
document.getElementsByTagName("head")[0].appendChild(styleElement);
|
||||
styleSheet = styleElement.sheet;
|
||||
mediaList = styleSheet.media;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
test(function() {
|
||||
setup();
|
||||
|
||||
assert_equals(mediaList.mediaText, "all");
|
||||
|
||||
|
||||
assert_equals(mediaList.mediaText, "all");
|
||||
|
||||
}, "mediatest_medialist_serialize_element",
|
||||
{ help: ["http://www.w3.org/TR/cssom/#the-medialist-interface", "http://www.w3.org/TR/cssom/#serializing-media-queries"],
|
||||
assert: ["MediaList.mediaText equals the 'media' value of the initial 'style' element."] });
|
||||
|
||||
test(function() {
|
||||
test(function() {
|
||||
setup();
|
||||
|
||||
|
||||
mediaList.appendMedium('screen');
|
||||
assert_equals(mediaList.mediaText, "all, screen");
|
||||
|
||||
assert_equals(mediaList.mediaText, "all, screen");
|
||||
|
||||
}, "mediatest_medialist_serialize_comma",
|
||||
{ help: ["http://www.w3.org/TR/cssom/#the-medialist-interface", "http://www.w3.org/TR/cssom/#serializing-media-queries"],
|
||||
assert: ["To serialize a comma-separated list concatenate all items of the list in list order while separating them by \",\" (U+002C), followed by a space (U+0020)."] });
|
||||
|
||||
|
||||
test(function() {
|
||||
setup();
|
||||
|
||||
|
||||
mediaList.deleteMedium('all');
|
||||
assert_equals(mediaList.mediaText, "");
|
||||
|
||||
assert_equals(mediaList.mediaText, "");
|
||||
|
||||
}, "mediatest_medialist_serialize_empty",
|
||||
{ help: ["http://www.w3.org/TR/cssom/#the-medialist-interface", "http://www.w3.org/TR/cssom/#serializing-media-queries"],
|
||||
assert: ["If the media query list is empty return the empty string."] });
|
||||
|
||||
|
||||
test(function() {
|
||||
setup();
|
||||
|
||||
|
||||
mediaList.appendMedium('screen');
|
||||
mediaList.appendMedium('print');
|
||||
assert_equals(mediaList.mediaText, "all, print, screen");
|
||||
|
||||
assert_equals(mediaList.mediaText, "all, print, screen");
|
||||
|
||||
}, "mediatest_medialist_serialize_lexicographical",
|
||||
{ help: ["http://www.w3.org/TR/cssom/#the-medialist-interface", "http://www.w3.org/TR/cssom/#serializing-media-queries"],
|
||||
assert: ["Each media query in the list of media queries should be sorted in lexicographical order."] });
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
</body></html>
|
|
@ -23,15 +23,15 @@
|
|||
<noscript>Test not run - javascript required.</noscript>
|
||||
<div id="log"></div>
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
var styleElement;
|
||||
var styleSheet;
|
||||
var mediaList;
|
||||
|
||||
|
||||
// Setup - accepts media value for style element, e.g. <style media=???">
|
||||
function setupMedia(media) {
|
||||
styleElement = document.getElementById("styleElement");
|
||||
|
||||
|
||||
if (styleElement) {
|
||||
// teardown
|
||||
document.getElementsByTagName("head")[0].removeChild(styleElement);
|
||||
|
@ -39,33 +39,34 @@
|
|||
styleSheet = undefined;
|
||||
mediaList = undefined;
|
||||
}
|
||||
|
||||
|
||||
styleElement = document.createElement("style");
|
||||
styleElement.id = "styleElement";
|
||||
styleElement.type = "text/css";
|
||||
styleElement.media = media;
|
||||
document.getElementsByTagName("head")[0].appendChild(styleElement);
|
||||
document.getElementsByTagName("head")[0].appendChild(styleElement);
|
||||
styleSheet = styleElement.sheet;
|
||||
mediaList = styleSheet.media;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
test(function() {
|
||||
setupMedia('not screen and (min-WIDTH:5px) AND (max-width:40px )');
|
||||
|
||||
assert_equals(mediaList.mediaText, "not screen and (max-width: 40px) and (min-width: 5px)");
|
||||
|
||||
|
||||
assert_equals(mediaList.mediaText, "not screen and (max-width: 40px) and (min-width: 5px)");
|
||||
|
||||
}, "mediatest_mediaquery_serialize_1",
|
||||
{ assert: ["First explicit example input (first column) and output (second column) in specification."] });
|
||||
|
||||
test(function() {
|
||||
setupMedia('all and (color) and (color) ');
|
||||
|
||||
assert_equals(mediaList.mediaText, "(color)");
|
||||
assert_equals(mediaList.mediaText, "(color)");
|
||||
|
||||
}, "mediatest_mediaquery_serialize_2",
|
||||
{ assert: ["Second explicit example input (first column) and output (second column) in specification."] });
|
||||
|
||||
{ assert: ["Second explicit example input (first column) and output (second column) in specification."] });
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
</body></html>
|
|
@ -65,7 +65,7 @@
|
|||
assert_own_property(styleSheet, "cssRules");
|
||||
assert_inherits(styleSheet, "insertRule");
|
||||
assert_inherits(styleSheet, "deleteRule");
|
||||
|
||||
|
||||
assert_readonly(styleSheet, "ownerRule");
|
||||
assert_readonly(styleSheet, "cssRules");
|
||||
}, "CSSStyleSheet_properties",
|
||||
|
@ -113,7 +113,7 @@
|
|||
assert_equals(styleSheet.href, null);
|
||||
assert_regexp_match(linkSheet.href, /support\/b-green.css$/);
|
||||
assert_regexp_match(importSheet.href, /support\/a-green.css$/);
|
||||
|
||||
|
||||
assert_equals(styleSheet.parentStyleSheet, null);
|
||||
assert_equals(linkSheet.parentStyleSheet, null);
|
||||
assert_equals(importSheet.parentStyleSheet, styleSheet);
|
||||
|
@ -124,4 +124,5 @@
|
|||
{ assert: "StyleSheet initial property values are correct" });
|
||||
</script>
|
||||
|
||||
|
||||
</body></html>
|
|
@ -36,7 +36,7 @@
|
|||
assert: [ "Initial rule list is of size 1",
|
||||
"Can add a rule at first index" ]
|
||||
});
|
||||
|
||||
|
||||
test(function() {
|
||||
sheet.deleteRule(0);
|
||||
assert_equals(sheet.cssRules.length, 1);
|
||||
|
|
|
@ -3,42 +3,44 @@
|
|||
# http://test.csswg.org/suites/cssom-1_dev/DATESTAMP/
|
||||
# See http://wiki.csswg.org/test/implementation-report for instructions
|
||||
testname revision result comment
|
||||
html/computed-style-001.htm 923388f4dc84c4167d4c74b769957e559c061c8f ?
|
||||
xhtml1/computed-style-001.xht 923388f4dc84c4167d4c74b769957e559c061c8f ?
|
||||
html/css-style-declaration-modifications.htm 19938d46bb35487e2135073afe761f8dd772184d ?
|
||||
xhtml1/css-style-declaration-modifications.xht 19938d46bb35487e2135073afe761f8dd772184d ?
|
||||
html/cssimportrule.htm 9e027f3ad71718518e73bc43749fe1607c66be9b ?
|
||||
xhtml1/cssimportrule.xht 9e027f3ad71718518e73bc43749fe1607c66be9b ?
|
||||
html/computed-style-001.htm 39c06db4a79d5f4f5984bbfbc94617737015e605 ?
|
||||
xhtml1/computed-style-001.xht 39c06db4a79d5f4f5984bbfbc94617737015e605 ?
|
||||
html/css-style-declaration-modifications.htm 05a30b7434280c3e8a17544c5d3a36ca030ba72c ?
|
||||
xhtml1/css-style-declaration-modifications.xht 05a30b7434280c3e8a17544c5d3a36ca030ba72c ?
|
||||
html/cssimportrule.htm 6fb8ff5e50dc281810e8bdc3668a376c02748d64 ?
|
||||
xhtml1/cssimportrule.xht 6fb8ff5e50dc281810e8bdc3668a376c02748d64 ?
|
||||
html/cssom-cssstyledeclaration-set.htm b63533ef337d08541ec0fb5b70b618931b9809b0 ?
|
||||
xhtml1/cssom-cssstyledeclaration-set.xht b63533ef337d08541ec0fb5b70b618931b9809b0 ?
|
||||
html/cssom-csstext-serialize.htm 3e14e2c10025c3e4e66daa88ea819dc46bd8b529 ?
|
||||
xhtml1/cssom-csstext-serialize.xht 3e14e2c10025c3e4e66daa88ea819dc46bd8b529 ?
|
||||
html/cssom-setproperty-shorthand.htm 7630d8007322fed0af2c7d8e6f94585f3ae3703d ?
|
||||
xhtml1/cssom-setproperty-shorthand.xht 7630d8007322fed0af2c7d8e6f94585f3ae3703d ?
|
||||
html/cssstyledeclaration-csstext.htm 2cc8a22845a56b1cdc11d73b6af616fdc41c9695 ?
|
||||
xhtml1/cssstyledeclaration-csstext.xht 2cc8a22845a56b1cdc11d73b6af616fdc41c9695 ?
|
||||
html/cssstyledeclaration-csstext.htm 050d90a766fef18fee4d12855696c9850e89dda3 ?
|
||||
xhtml1/cssstyledeclaration-csstext.xht 050d90a766fef18fee4d12855696c9850e89dda3 ?
|
||||
html/cssstyledeclaration-mutability.htm 38cd7a355a26875bad54365ed7326a5dc51801de ?
|
||||
xhtml1/cssstyledeclaration-mutability.xht 38cd7a355a26875bad54365ed7326a5dc51801de ?
|
||||
html/cssstylerule.htm f75d9df40ead266de11163af127e75dc9b2a2b2f ?
|
||||
xhtml1/cssstylerule.xht f75d9df40ead266de11163af127e75dc9b2a2b2f ?
|
||||
html/escape.htm 7aea68a9623bb9dff127afbd42801555f82c01cc ?
|
||||
xhtml1/escape.xht 7aea68a9623bb9dff127afbd42801555f82c01cc ?
|
||||
html/index-001.htm 690f3025eb8ad461891d7cd861467a6dfd15c3c6 ?
|
||||
xhtml1/index-001.xht 690f3025eb8ad461891d7cd861467a6dfd15c3c6 ?
|
||||
html/index-002.htm 0bc1c948a918adda327afe34f4a31d3aafec67e3 ?
|
||||
xhtml1/index-002.xht 0bc1c948a918adda327afe34f4a31d3aafec67e3 ?
|
||||
html/index-003.htm e43febd0e99d020f2c1aff26ff1a62ce40c1614a ?
|
||||
xhtml1/index-003.xht e43febd0e99d020f2c1aff26ff1a62ce40c1614a ?
|
||||
html/inline-style-001.htm f04334e818f64c3df86a59802b9f97b308a381f0 ?
|
||||
xhtml1/inline-style-001.xht f04334e818f64c3df86a59802b9f97b308a381f0 ?
|
||||
html/cssstylerule.htm 8bda79669808b037722d77c414a75d08b7d03d2e ?
|
||||
xhtml1/cssstylerule.xht 8bda79669808b037722d77c414a75d08b7d03d2e ?
|
||||
html/escape.htm 4779768a26a639395ce78173147b71159b477640 ?
|
||||
xhtml1/escape.xht 4779768a26a639395ce78173147b71159b477640 ?
|
||||
html/index-001.htm 881e59e324c6f1d388b3809854a5a66989bc7f55 ?
|
||||
xhtml1/index-001.xht 881e59e324c6f1d388b3809854a5a66989bc7f55 ?
|
||||
html/index-002.htm 740237d18cd5e853d40313d6f3abd732815d4d90 ?
|
||||
xhtml1/index-002.xht 740237d18cd5e853d40313d6f3abd732815d4d90 ?
|
||||
html/index-003.htm 45c8b18b72e72295cabf7f1baaca94f8eb0233ef ?
|
||||
xhtml1/index-003.xht 45c8b18b72e72295cabf7f1baaca94f8eb0233ef ?
|
||||
html/inline-style-001.htm 947872aa8c1589adc78e5bdb586c116e451ed6a3 ?
|
||||
xhtml1/inline-style-001.xht 947872aa8c1589adc78e5bdb586c116e451ed6a3 ?
|
||||
html/interfaces.htm 10c290ccb9207edb0489cd90e857a383674743a7 ?
|
||||
xhtml1/interfaces.xht 10c290ccb9207edb0489cd90e857a383674743a7 ?
|
||||
html/matchmedia.htm 968cc094c6258392a6d1f8dd5eb814f43ed6692f ?
|
||||
xhtml1/matchmedia.xht 968cc094c6258392a6d1f8dd5eb814f43ed6692f ?
|
||||
html/medialist-interfaces-001.htm 18c6ca7690229435cd46aed160d37c7150f6fb6d ?
|
||||
xhtml1/medialist-interfaces-001.xht 18c6ca7690229435cd46aed160d37c7150f6fb6d ?
|
||||
html/medialist-interfaces-001.htm 8f997f3ca2338a1f634f076d2add4b6ac8b30019 ?
|
||||
xhtml1/medialist-interfaces-001.xht 8f997f3ca2338a1f634f076d2add4b6ac8b30019 ?
|
||||
html/medialist-interfaces-002.htm c04d5564112f6761478aeaf604c428307b72c993 ?
|
||||
xhtml1/medialist-interfaces-002.xht c04d5564112f6761478aeaf604c428307b72c993 ?
|
||||
html/medialist-interfaces-003.htm 7427259c9bacaa3c80010691d0405f7954e7e040 ?
|
||||
xhtml1/medialist-interfaces-003.xht 7427259c9bacaa3c80010691d0405f7954e7e040 ?
|
||||
html/medialist-interfaces-003.htm d7870ae5845c7c895fce2f1cbcd1df4dfd5856b1 ?
|
||||
xhtml1/medialist-interfaces-003.xht d7870ae5845c7c895fce2f1cbcd1df4dfd5856b1 ?
|
||||
html/medialist-interfaces-004.htm 5e031a138cf16515b8b2ad1d31bf27780d5c6f64 ?
|
||||
xhtml1/medialist-interfaces-004.xht 5e031a138cf16515b8b2ad1d31bf27780d5c6f64 ?
|
||||
html/medialist.htm 950f388af24cce357db899c6fdd58f0a785aa5e3 ?
|
||||
|
@ -51,10 +53,10 @@ html/shape-outside-shape-arguments-001.htm 9dd0113414a623dabe94f0e29eb616393dc49
|
|||
xhtml1/shape-outside-shape-arguments-001.xht 9dd0113414a623dabe94f0e29eb616393dc49315 ?
|
||||
html/shape-outside-shape-notation-000.htm f60e7fa2061e9a98c83fd1e9cb3d2c094ae544e1 ?
|
||||
xhtml1/shape-outside-shape-notation-000.xht f60e7fa2061e9a98c83fd1e9cb3d2c094ae544e1 ?
|
||||
html/style-sheet-interfaces-001.htm 5c0da884ebc0052b5b1035e7a6968be0791a002f ?
|
||||
xhtml1/style-sheet-interfaces-001.xht 5c0da884ebc0052b5b1035e7a6968be0791a002f ?
|
||||
html/style-sheet-interfaces-002.htm 5445e593037f6bcef142eb603216810b90d426dd ?
|
||||
xhtml1/style-sheet-interfaces-002.xht 5445e593037f6bcef142eb603216810b90d426dd ?
|
||||
html/style-sheet-interfaces-001.htm 839ee75d556ca217573bba98b277215ad8d151eb ?
|
||||
xhtml1/style-sheet-interfaces-001.xht 839ee75d556ca217573bba98b277215ad8d151eb ?
|
||||
html/style-sheet-interfaces-002.htm 01a559cfc56aff0e76b58c9f8f0151f13b121ed2 ?
|
||||
xhtml1/style-sheet-interfaces-002.xht 01a559cfc56aff0e76b58c9f8f0151f13b121ed2 ?
|
||||
html/ttwf-cssom-doc-ext-load-count.htm 606e8f8f1b737f92ece2e0b30094156f171f7c88 ?
|
||||
xhtml1/ttwf-cssom-doc-ext-load-count.xht 606e8f8f1b737f92ece2e0b30094156f171f7c88 ?
|
||||
html/ttwf-cssom-doc-ext-load-tree-order.htm 974597c116d1c92c4aa72d03890c4fecf5f8aed5 ?
|
||||
|
|
|
@ -1,30 +1,31 @@
|
|||
id references title flags links revision credits assertion
|
||||
computed-style-001 getComputedStyle dom,script http://www.w3.org/TR/cssom/#extensions-to-the-window-interface,http://www.w3.org/TR/cssom/#the-cssstyledeclaration-interface,http://www.w3.org/TR/cssom/#resolved-values 923388f4dc84c4167d4c74b769957e559c061c8f `Bear Travis`<mailto:betravis@adobe.com> getComputedStyle returns a readonly CSSStyleDeclaration with resolved values
|
||||
css-style-declaration-modifications CSSStyleDeclaration Interface dom,script http://www.w3.org/TR/cssom/#the-cssstyledeclaration-interface 19938d46bb35487e2135073afe761f8dd772184d `Bear Travis`<mailto:betravis@adobe.com> CSSStyleDeclaration is properly initialized and can be modified through its interface
|
||||
cssimportrule CSSOM CSSRule CSSImportRule interface dom,script http://www.w3.org/TR/cssom/#css-rules,http://www.w3.org/TR/cssom/#the-cssrule-interface,http://www.w3.org/TR/cssom/#the-cssimportrule-interface 9e027f3ad71718518e73bc43749fe1607c66be9b `Letitia Lew`<mailto:lew.letitia@gmail.com> All properties for this CSSImportRule instance of CSSRule are initialized correctly
|
||||
computed-style-001 getComputedStyle dom,script http://www.w3.org/TR/cssom/#extensions-to-the-window-interface,http://www.w3.org/TR/cssom/#the-cssstyledeclaration-interface,http://www.w3.org/TR/cssom/#resolved-values 39c06db4a79d5f4f5984bbfbc94617737015e605 `Bear Travis`<mailto:betravis@adobe.com> getComputedStyle returns a readonly CSSStyleDeclaration with resolved values
|
||||
css-style-declaration-modifications CSSStyleDeclaration Interface dom,script http://www.w3.org/TR/cssom/#the-cssstyledeclaration-interface 05a30b7434280c3e8a17544c5d3a36ca030ba72c `Bear Travis`<mailto:betravis@adobe.com> CSSStyleDeclaration is properly initialized and can be modified through its interface
|
||||
cssimportrule CSSOM CSSRule CSSImportRule interface dom,script http://www.w3.org/TR/cssom/#css-rules,http://www.w3.org/TR/cssom/#the-cssrule-interface,http://www.w3.org/TR/cssom/#the-cssimportrule-interface 6fb8ff5e50dc281810e8bdc3668a376c02748d64 `Letitia Lew`<mailto:lew.letitia@gmail.com> All properties for this CSSImportRule instance of CSSRule are initialized correctly
|
||||
cssom-cssstyledeclaration-set CSSOM: CSSStyleDeclaration on HTMLElement represents inline style changes dom,script http://www.w3.org/TR/cssom/#the-cssstyledeclaration-interface b63533ef337d08541ec0fb5b70b618931b9809b0 `Paul Irish`<mailto:paul.irish@gmail.com>
|
||||
cssom-cssText-serialize getting cssText must return the result of serializing the CSS declaration blocks. dom,script http://www.w3.org/TR/cssom/#the-cssstyledeclaration-interface 3e14e2c10025c3e4e66daa88ea819dc46bd8b529 `Paul Irish`<mailto:paul.irish@gmail.com>
|
||||
cssom-setProperty-shorthand CSSOM: CSSStyleDeclaration (set|remove)PropertyValue sets/removes shorthand properties dom,script http://www.w3.org/TR/cssom/#the-cssstyledeclaration-interface 7630d8007322fed0af2c7d8e6f94585f3ae3703d `Paul Irish`<mailto:paul.irish@gmail.com>
|
||||
cssstyledeclaration-csstext CSSStyleDeclaration.cssText Test dom,script https://drafts.csswg.org/cssom-1/#dom-cssstyledeclaration-csstext 2cc8a22845a56b1cdc11d73b6af616fdc41c9695 `kkoichi`<coarse.ground@gmail.com> CSS declarations is serialized as expected
|
||||
cssstyledeclaration-csstext CSSStyleDeclaration.cssText Test dom,script https://drafts.csswg.org/cssom-1/#dom-cssstyledeclaration-csstext 050d90a766fef18fee4d12855696c9850e89dda3 `kkoichi`<coarse.ground@gmail.com> CSS declarations is serialized as expected
|
||||
cssstyledeclaration-mutability CSSOM: CSSStyleDeclaration is mutable and immutable in various settings dom,script http://www.w3.org/TR/cssom/#the-cssstyledeclaration-interface 38cd7a355a26875bad54365ed7326a5dc51801de `Paul Irish`<mailto:paul.irish@gmail.com>
|
||||
cssstylerule CSSOM CSSRule CSSStyleRule interface dom,script http://www.w3.org/TR/cssom/#css-rules,http://www.w3.org/TR/cssom/#the-cssrule-interface,http://www.w3.org/TR/cssom/#the-cssstylerule-interface f75d9df40ead266de11163af127e75dc9b2a2b2f `Letitia Lew`<mailto:lew.letitia@gmail.com> All properties for this CSSStyleRule instance of CSSRule are initialized correctly
|
||||
escape CSS#escape script https://drafts.csswg.org/cssom-1/#the-css.escape()-method 7aea68a9623bb9dff127afbd42801555f82c01cc
|
||||
index-001 CSS OM: CSS Values dom,script http://www.w3.org/TR/cssom/#css-values 690f3025eb8ad461891d7cd861467a6dfd15c3c6 `Divya Manian`<mailto:manian@adobe.com> The style value should be serialized to margin: 20px;
|
||||
index-002 CSS OM: CSS Values dom,script http://www.w3.org/TR/cssom/#css-values 0bc1c948a918adda327afe34f4a31d3aafec67e3 `Divya Manian`<mailto:manian@adobe.com> Testing Serialization of Shorthand Values
|
||||
index-003 CSS OM: CSS Values dom,script http://www.w3.org/TR/cssom/#the-cssrulelist-interface e43febd0e99d020f2c1aff26ff1a62ce40c1614a `Divya Manian`<mailto:manian@adobe.com> Testing Serialization of Style Rules
|
||||
inline-style-001 Inline CSSStyleDeclaration dom,script http://www.w3.org/TR/cssom/#elementcssinlinestyle f04334e818f64c3df86a59802b9f97b308a381f0 `Bear Travis`<mailto:betravis@adobe.com> Inline CSSStyleDeclaration is properly initialized and can be modified through its interface
|
||||
cssstylerule CSSOM CSSRule CSSStyleRule interface dom,script http://www.w3.org/TR/cssom/#css-rules,http://www.w3.org/TR/cssom/#the-cssrule-interface,http://www.w3.org/TR/cssom/#the-cssstylerule-interface 8bda79669808b037722d77c414a75d08b7d03d2e `Letitia Lew`<mailto:lew.letitia@gmail.com> All properties for this CSSStyleRule instance of CSSRule are initialized correctly
|
||||
escape CSS#escape script https://drafts.csswg.org/cssom-1/#the-css.escape()-method 4779768a26a639395ce78173147b71159b477640
|
||||
index-001 CSS OM: CSS Values dom,script http://www.w3.org/TR/cssom/#css-values 881e59e324c6f1d388b3809854a5a66989bc7f55 `Divya Manian`<mailto:manian@adobe.com> The style value should be serialized to margin: 20px;
|
||||
index-002 CSS OM: CSS Values dom,script http://www.w3.org/TR/cssom/#css-values 740237d18cd5e853d40313d6f3abd732815d4d90 `Divya Manian`<mailto:manian@adobe.com> Testing Serialization of Shorthand Values
|
||||
index-003 CSS OM: CSS Values dom,script http://www.w3.org/TR/cssom/#the-cssrulelist-interface 45c8b18b72e72295cabf7f1baaca94f8eb0233ef `Divya Manian`<mailto:manian@adobe.com> Testing Serialization of Style Rules
|
||||
inline-style-001 Inline CSSStyleDeclaration dom,script http://www.w3.org/TR/cssom/#elementcssinlinestyle 947872aa8c1589adc78e5bdb586c116e451ed6a3 `Bear Travis`<mailto:betravis@adobe.com> Inline CSSStyleDeclaration is properly initialized and can be modified through its interface
|
||||
interfaces CSSOM automated IDL tests script https://drafts.csswg.org/cssom-1/#idl-index 10c290ccb9207edb0489cd90e857a383674743a7 `Ms2ger`<mailto:Ms2ger@gmail.com>
|
||||
matchMedia CSSOM View matchMedia and MediaQueryList dom,script http://www.w3.org/TR/cssom-view/#dom-window-matchmedia,http://www.w3.org/TR/cssom-view/#the-mediaquerylist-interface,http://www.w3.org/TR/cssom/#serializing-media-queries 968cc094c6258392a6d1f8dd5eb814f43ed6692f `Rune Lillesveen`<mailto:rune@opera.com>
|
||||
MediaList the MediaList interface script http://www.w3.org/TR/cssom/#the-medialist-interface,http://dev.w3.org/2006/webapi/WebIDL/#getownproperty 950f388af24cce357db899c6fdd58f0a785aa5e3 `Ms2ger`<mailto:Ms2ger@gmail.com>
|
||||
medialist-interfaces-001 CSSOM Media Query List Serialization dom,script http://www.w3.org/TR/cssom/#the-medialist-interface 18c6ca7690229435cd46aed160d37c7150f6fb6d `Ben Sheldon`<mailto:ben@codeforamerica.org>,`Chapman Shoop`<mailto:chapman.shoop@gmail.com> MediaLists are serialized according to the specification
|
||||
medialist-interfaces-001 CSSOM Media Query List Serialization dom,script http://www.w3.org/TR/cssom/#the-medialist-interface 8f997f3ca2338a1f634f076d2add4b6ac8b30019 `Ben Sheldon`<mailto:ben@codeforamerica.org>,`Chapman Shoop`<mailto:chapman.shoop@gmail.com> MediaLists are serialized according to the specification
|
||||
medialist-interfaces-002 CSSOM MediaList Interfaces dom,script http://www.w3.org/TR/cssom/#the-medialist-interface c04d5564112f6761478aeaf604c428307b72c993 `Chapman Shoop`<mailto:chapman.shoop@gmail.com> MediaList object has deleteMedium method and it functions properly.
|
||||
medialist-interfaces-003 CSSOM Media Query Serialization dom,script http://www.w3.org/TR/cssom/#serializing-media-queries 7427259c9bacaa3c80010691d0405f7954e7e040 `Ben Sheldon`<mailto:ben@codeforamerica.org>,`Chapman Shoop`<mailto:chapman.shoop@gmail.com> Media Queries are serialized according to the specification
|
||||
medialist-interfaces-003 CSSOM Media Query Serialization dom,script http://www.w3.org/TR/cssom/#serializing-media-queries d7870ae5845c7c895fce2f1cbcd1df4dfd5856b1 `Ben Sheldon`<mailto:ben@codeforamerica.org>,`Chapman Shoop`<mailto:chapman.shoop@gmail.com> Media Queries are serialized according to the specification
|
||||
medialist-interfaces-004 CSSOM MediaList Interfaces dom,script http://www.w3.org/TR/cssom/#the-medialist-interface 5e031a138cf16515b8b2ad1d31bf27780d5c6f64 `Chapman Shoop`<mailto:chapman.shoop@gmail.com> MediaList object has appendMedium method and it functions properly.
|
||||
selectorSerialize test serialized selector which is only one simple selector in the sequence of simple selectors dom,script https://drafts.csswg.org/cssom-1/#serializing-selectors cb441f03c4ab09e33cce9c5c96a60afc7a7b463d `T.Nishitani`<mailto:lequinharay@gmail.com>
|
||||
shape-outside-shape-arguments-000 Shape Outside Basic Shape Arguments dom,script http://www.w3.org/TR/css-shapes-1/#typedef-basic-shape,http://www.w3.org/TR/css-shapes-1/#shape-outside-property,http://www.w3.org/TR/cssom/#serializing-css-values 8e30b0aa976388a251ee8392188230ae8d983576 `Adobe`<http://html.adobe.com/>,`Bear Travis`<mailto:betravis@adobe.com> A basic basic shape can contain any length unit type, or percentage
|
||||
shape-outside-shape-arguments-001 Shape Outside Shape Number Values dom,script http://www.w3.org/TR/css-shapes-1/#typedef-basic-shape,http://www.w3.org/TR/css-shapes-1/#shape-outside-property,http://www.w3.org/TR/cssom/#serializing-css-values 9dd0113414a623dabe94f0e29eb616393dc49315 `Adobe`<http://html.adobe.com/>,`Bear Travis`<mailto:betravis@adobe.com> The basic shape can contain all valid number formats
|
||||
shape-outside-shape-notation-000 Shape Outside Valid Basic Shape Functional Notation dom,script http://www.w3.org/TR/css-shapes-1/#shape-outside-property,http://www.w3.org/TR/cssom/#serializing-css-values f60e7fa2061e9a98c83fd1e9cb3d2c094ae544e1 `Adobe`<http://html.adobe.com/>,`Bear Travis`<mailto:betravis@adobe.com> Basic shapes use functional notation, and may contain optional whitespace inside the parentheses
|
||||
style-sheet-interfaces-001 CSSOM StyleSheet Initial Values dom,script http://www.w3.org/TR/cssom/#css-style-sheets 5c0da884ebc0052b5b1035e7a6968be0791a002f `Bear Travis`<mailto:betravis@adobe.com> StyleSheet and CSSStyleSheet objects have the properties specified in their interfaces
|
||||
style-sheet-interfaces-002 CSSOM StyleSheet Modify Rule List dom,script http://www.w3.org/TR/cssom/#the-cssstylesheet-interface,http://www.w3.org/TR/cssom/#the-cssrule-interface 5445e593037f6bcef142eb603216810b90d426dd `Bear Travis`<mailto:betravis@adobe.com> StyleSheet and CSSStyleSheet objects have the properties specified in their interfaces
|
||||
style-sheet-interfaces-001 CSSOM StyleSheet Initial Values dom,script http://www.w3.org/TR/cssom/#css-style-sheets 839ee75d556ca217573bba98b277215ad8d151eb `Bear Travis`<mailto:betravis@adobe.com> StyleSheet and CSSStyleSheet objects have the properties specified in their interfaces
|
||||
style-sheet-interfaces-002 CSSOM StyleSheet Modify Rule List dom,script http://www.w3.org/TR/cssom/#the-cssstylesheet-interface,http://www.w3.org/TR/cssom/#the-cssrule-interface 01a559cfc56aff0e76b58c9f8f0151f13b121ed2 `Bear Travis`<mailto:betravis@adobe.com> StyleSheet and CSSStyleSheet objects have the properties specified in their interfaces
|
||||
ttwf-cssom-doc-ext-load-count CSSOM - Extensions to the Document Interface: StyleSheetList length reflects dynamically loaded and unloaded sheets dom,script http://www.w3.org/TR/cssom/#extensions-to-the-document-interface,http://www.w3.org/TR/cssom/#the-stylesheetlist-interface,http://www.w3.org/TR/cssom/#css-style-sheet-collections 606e8f8f1b737f92ece2e0b30094156f171f7c88 `Jesse Bounds`<mailto:jesse@codeforamerica.org> The styleSheets length attribute must reflect the number of sheets at page load and after dynamically
|
||||
ttwf-cssom-doc-ext-load-tree-order CSSOM - Extensions to the Document Interface: Stylesheet header load order dom,script http://www.w3.org/TR/cssom/#extensions-to-the-document-interface,http://www.w3.org/TR/cssom/#the-stylesheetlist-interface,http://www.w3.org/TR/cssom/#css-style-sheet-collections 974597c116d1c92c4aa72d03890c4fecf5f8aed5 `Jesse Bounds`<mailto:jesse@codeforamerica.org> Document's style sheets created from HTTP Link headers are first in list and loaded in header order
|
||||
ttwf-cssom-document-extension CSSOM - Extensions to the Document Interface: StyleSheetList length is 0 when no sheets loaded dom,script http://www.w3.org/TR/cssom/#extensions-to-the-document-interface,http://www.w3.org/TR/cssom/#the-stylesheetlist-interface cadf446d51e50a32ceb59b62191bd88993021465 `Jesse Bounds`<mailto:jesse@codeforamerica.org> The styleSheets attribute must return a StyleSheetList sequence representing the document style sheets.
|
||||
|
|
|
@ -39,10 +39,10 @@
|
|||
var outer = document.getElementById("outside");
|
||||
var inner = document.getElementById("inside");
|
||||
var innerStyle;
|
||||
|
||||
|
||||
test(function() {
|
||||
innerStyle = window.getComputedStyle(inner);
|
||||
assert_throws( "NO_MODIFICATION_ALLOWED_ERR",
|
||||
assert_throws( "NO_MODIFICATION_ALLOWED_ERR",
|
||||
function() { innerStyle.cssText = "color: blue;"; },
|
||||
"do not allow setting cssText on a readonly CSSStyleDeclaration");
|
||||
assert_throws( "NO_MODIFICATION_ALLOWED_ERR",
|
||||
|
@ -51,10 +51,10 @@
|
|||
assert_throws( "NO_MODIFICATION_ALLOWED_ERR",
|
||||
function() { innerStyle.color = "blue"; },
|
||||
"do not allow setting a property on a readonly CSSStyleDeclaration");
|
||||
}, "read_only", {
|
||||
}, "read_only", {
|
||||
assert: "do not allow modifications to a computed CSSStyleDeclaration"
|
||||
});
|
||||
|
||||
|
||||
test(function() {
|
||||
assert_equals(innerStyle.getPropertyValue("height"), "100px");
|
||||
}, "property_values", {
|
||||
|
@ -66,7 +66,7 @@
|
|||
}, "inherited_property_values", {
|
||||
assert: "Inherited properties are resolved"
|
||||
});
|
||||
|
||||
|
||||
test(function() {
|
||||
assert_equals(innerStyle.getPropertyValue("width"), "100px");
|
||||
}, "relative_property_values", {
|
||||
|
|
|
@ -10,87 +10,54 @@
|
|||
<style id="styleElement">
|
||||
#test { color: green; }
|
||||
</style>
|
||||
<script id="metadata_cache">/*
|
||||
{
|
||||
"CSSStyleDeclaration_accessible": {
|
||||
"help": ["http://www.w3.org/TR/cssom/#the-cssstylesheet-interface",
|
||||
"http://www.w3.org/TR/cssom/#the-cssrulelist-interface",
|
||||
"http://www.w3.org/TR/cssom/#the-cssstylerule-interface"],
|
||||
"assert": "Can access CSSStyleDeclaration through CSSOM"
|
||||
},
|
||||
"read": { "assert": "initial property values are correct" },
|
||||
"csstext_write": {
|
||||
"assert": ["setting cssText adds new properties",
|
||||
"setting cssText removes existing properties",
|
||||
"properties set through cssText are reflected in the computed style"]
|
||||
},
|
||||
"property_write": {
|
||||
"assert": ["setProperty adds new properties",
|
||||
"properties set through setProperty are reflected in the computed style"]
|
||||
}
|
||||
}
|
||||
*/</script>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>Test not run - javascript required.</noscript>
|
||||
<div id="log"></div>
|
||||
<div id="test"></div>
|
||||
<script type="text/javascript">
|
||||
var styleElement = document.getElementById("styleElement");
|
||||
var styleDeclaration;
|
||||
test(function() {
|
||||
assert_own_property(styleElement, "sheet");
|
||||
assert_own_property(styleElement.sheet, "cssRules");
|
||||
assert_true(styleElement.sheet.cssRules instanceof CSSRuleList);
|
||||
assert_true(styleElement.sheet.cssRules.item(0) instanceof CSSStyleRule);
|
||||
declaration = styleElement.sheet.cssRules.item(0).style;
|
||||
}, "CSSStyleDeclaration_accessible",
|
||||
{ help: [ "http://www.w3.org/TR/cssom/#the-cssstylesheet-interface",
|
||||
"http://www.w3.org/TR/cssom/#the-cssrulelist-interface",
|
||||
"http://www.w3.org/TR/cssom/#the-cssstylerule-interface" ],
|
||||
assert: "Can access CSSStyleDeclaration through CSSOM" });
|
||||
var declaration;
|
||||
setup(function() {
|
||||
var styleElement = document.getElementById("styleElement");
|
||||
declaration = styleElement.sheet.cssRules.item(0).style;
|
||||
});
|
||||
|
||||
test(function() {
|
||||
assert_regexp_match(declaration.cssText, /color: green;\s*/);
|
||||
test(function() {
|
||||
assert_equals(declaration.cssText, "color: green;");
|
||||
assert_equals(declaration.getPropertyValue("color"), "green");
|
||||
}, "read",
|
||||
{ assert: "initial property values are correct" });
|
||||
}, "Reading CSSStyleDeclaration initialized from a style element");
|
||||
|
||||
test(function() {
|
||||
declaration.cssText = "margin-left: 10px; padding-left: 10px;";
|
||||
assert_regexp_match(declaration.cssText, /margin-left: 10px;\s+padding-left: 10px;\s+/);
|
||||
declaration.cssText = "margin-left:10px; padding-left:10px";
|
||||
assert_equals(declaration.cssText, "margin-left: 10px; padding-left: 10px;");
|
||||
assert_equals(declaration.length, 2);
|
||||
assert_equals(declaration.item(0), "margin-left");
|
||||
assert_equals(declaration.item(1), "padding-left");
|
||||
assert_equals(declaration.getPropertyValue("margin-left"), "10px");
|
||||
assert_equals(declaration.getPropertyValue("padding-left"), "10px");
|
||||
|
||||
|
||||
var computedStyle = window.getComputedStyle(document.getElementById("test"));
|
||||
assert_equals(computedStyle.getPropertyValue("margin-left"), "10px");
|
||||
assert_equals(computedStyle.getPropertyValue("padding-left"), "10px");
|
||||
}, "csstext_write",
|
||||
{ assert: [ "setting cssText adds new properties",
|
||||
"setting cssText removes existing properties",
|
||||
"properties set through cssText are reflected in the computed style"] });
|
||||
}, "Setting CSSStyleDeclaration#cssText");
|
||||
|
||||
test(function() {
|
||||
while(declaration.length > 0)
|
||||
while (declaration.length > 0) {
|
||||
declaration.removeProperty(declaration.item(0));
|
||||
}
|
||||
declaration.setProperty("margin-left", "15px");
|
||||
declaration.setProperty("padding-left", "15px");
|
||||
|
||||
|
||||
assert_equals(declaration.length, 2);
|
||||
assert_equals(declaration.item(0), "margin-left");
|
||||
assert_equals(declaration.item(1), "padding-left");
|
||||
assert_equals(declaration.getPropertyValue("margin-left"), "15px");
|
||||
assert_equals(declaration.getPropertyValue("padding-left"), "15px");
|
||||
|
||||
|
||||
var computedStyle = window.getComputedStyle(document.getElementById("test"));
|
||||
assert_equals(computedStyle.getPropertyValue("margin-left"), "15px");
|
||||
assert_equals(computedStyle.getPropertyValue("padding-left"), "15px");
|
||||
}, "property_write",
|
||||
{ assert: [ "setProperty adds new properties",
|
||||
"properties set through setProperty are reflected in the computed style"] });
|
||||
}, "Calling CSSStyleDeclaration#setProperty");
|
||||
</script>
|
||||
|
||||
|
||||
</body></html>
|
|
@ -6,51 +6,33 @@
|
|||
<link href="http://www.w3.org/TR/cssom/#the-cssrule-interface" rel="help" />
|
||||
<link href="http://www.w3.org/TR/cssom/#the-cssimportrule-interface" rel="help" />
|
||||
<meta content="dom" name="flags" />
|
||||
<meta content="All properties for this CSSImportRule instance of CSSRule are initialized correctly" name="assert" />
|
||||
<meta content="All properties for this CSSImportRule instance of CSSRule are initialized correctly" name="assert" />
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
|
||||
<style type="text/css" id="styleElement">
|
||||
@import url("support/a-green.css");
|
||||
@import url("support/a-green.css") screen;
|
||||
</style>
|
||||
|
||||
<script id="metadata_cache">/*
|
||||
{
|
||||
"CSSRule and CSSImportRule types": { "assert": "rule is an instance of CSSRule and CSSImportRule" },
|
||||
"Rule_type_property": { "assert": "CSSRule type property has correct type and constants" },
|
||||
"CSSRule_properties": {
|
||||
"assert": ["cssText, parentRule, parentStyleSheet properties exist on CSSRule",
|
||||
"type, parentRule, parentStyleSheet properties on CSSRule are readonly"]
|
||||
},
|
||||
"CSSRule_properties_values": { "assert": "type, parentRule, parentStyleSheet initial property values on CSSRule are correct" },
|
||||
"CSSImportRule_properties": {
|
||||
"assert": ["href, media, styleSheet properties exist on CSSImportsRule",
|
||||
"href, media, styleSheet properties are readonly"]
|
||||
},
|
||||
"CSSImportRule_properties_values": { "assert": "Initial values of href, media, styleSheet properties on CSSImportRule are correct" }
|
||||
}
|
||||
*/</script>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>Test not run -- JavaScript required.</noscript>
|
||||
<div id="log"></div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var styleSheet = document.getElementById("styleElement").sheet;
|
||||
var ruleList = styleSheet.cssRules;
|
||||
|
||||
var rule = ruleList[0];
|
||||
var ruleWithMedia = ruleList[1];
|
||||
var rule, ruleWithMedia;
|
||||
setup(function() {
|
||||
var styleSheet = document.getElementById("styleElement").sheet;
|
||||
var ruleList = styleSheet.cssRules;
|
||||
rule = ruleList[0];
|
||||
ruleWithMedia = ruleList[1];
|
||||
});
|
||||
|
||||
test(function() {
|
||||
assert_true(rule instanceof CSSRule);
|
||||
assert_true(rule instanceof CSSImportRule);
|
||||
assert_true(ruleWithMedia instanceof CSSRule);
|
||||
assert_true(ruleWithMedia instanceof CSSImportRule);
|
||||
}, "CSSRule and CSSImportRule types",
|
||||
{ assert: "rule is an instance of CSSRule and CSSImportRule" }
|
||||
);
|
||||
}, "CSSRule and CSSImportRule types");
|
||||
|
||||
test(function() {
|
||||
assert_equals(rule.STYLE_RULE, 1);
|
||||
|
@ -59,47 +41,39 @@
|
|||
assert_equals(rule.FONT_FACE_RULE, 5);
|
||||
assert_equals(rule.PAGE_RULE, 6);
|
||||
assert_equals(rule.NAMESPACE_RULE, 10);
|
||||
assert_own_property(rule, "type");
|
||||
assert_true(typeof rule.type === "number");
|
||||
}, "Rule_type_property",
|
||||
{ assert: "CSSRule type property has correct type and constants" }
|
||||
);
|
||||
assert_idl_attribute(rule, "type");
|
||||
assert_equals(typeof rule.type, "number");
|
||||
}, "Type of CSSRule#type and constant values");
|
||||
|
||||
test(function() {
|
||||
assert_true(rule instanceof CSSRule);
|
||||
assert_own_property(rule, "cssText");
|
||||
assert_own_property(rule, "parentRule");
|
||||
assert_own_property(rule, "parentStyleSheet");
|
||||
assert_idl_attribute(rule, "cssText");
|
||||
assert_idl_attribute(rule, "parentRule");
|
||||
assert_idl_attribute(rule, "parentStyleSheet");
|
||||
|
||||
assert_readonly(rule, "type");
|
||||
assert_readonly(rule, "parentRule");
|
||||
assert_readonly(rule, "parentStyleSheet");
|
||||
}, "CSSRule_properties",
|
||||
{ assert: ["cssText, parentRule, parentStyleSheet properties exist on CSSRule", "type, parentRule, parentStyleSheet properties on CSSRule are readonly"] }
|
||||
);
|
||||
}, "Existence and writability of CSSRule attributes");
|
||||
|
||||
test(function() {
|
||||
assert_equals(rule.type, rule.IMPORT_RULE);
|
||||
assert_equals(typeof rule.cssText, "string");
|
||||
assert_equals(rule.cssText, "@import url(\"cssimportrule.css\");");
|
||||
assert_equals(ruleWithMedia.cssText, "@import url(\"cssimportrule.css\") screen;");
|
||||
assert_equals(rule.cssText, '@import url("support/a-green.css");');
|
||||
assert_equals(ruleWithMedia.cssText, '@import url("support/a-green.css") screen;');
|
||||
assert_equals(rule.parentRule, null);
|
||||
assert_true(rule.parentStyleSheet instanceof CSSStyleSheet);
|
||||
}, "CSSRule_properties_values",
|
||||
{ assert: "type, parentRule, parentStyleSheet initial property values on CSSRule are correct" }
|
||||
);
|
||||
}, "Values of CSSRule attributes");
|
||||
|
||||
test(function() {
|
||||
assert_own_property(rule, "href");
|
||||
assert_own_property(rule, "media");
|
||||
assert_own_property(rule, "styleSheet");
|
||||
assert_idl_attribute(rule, "href");
|
||||
assert_idl_attribute(rule, "media");
|
||||
assert_idl_attribute(rule, "styleSheet");
|
||||
|
||||
assert_readonly(rule, "href");
|
||||
assert_readonly(rule, "media");
|
||||
assert_readonly(rule, "styleSheet");
|
||||
}, "CSSImportRule_properties",
|
||||
{ assert: ["href, media, styleSheet properties exist on CSSImportsRule", "href, media, styleSheet properties are readonly"] }
|
||||
);
|
||||
}, "Existence and writability of CSSImportRule attributes");
|
||||
|
||||
test(function() {
|
||||
assert_equals(typeof rule.href, "string");
|
||||
|
@ -107,10 +81,7 @@
|
|||
assert_true(rule.styleSheet instanceof CSSStyleSheet);
|
||||
assert_true(ruleWithMedia.media.length > 0);
|
||||
assert_equals(ruleWithMedia.media.mediaText, "screen");
|
||||
}, "CSSImportRule_properties_values",
|
||||
{ assert: "Initial values of href, media, styleSheet properties on CSSImportRule are correct" }
|
||||
);
|
||||
|
||||
}, "Values of CSSImportRule attributes");
|
||||
</script>
|
||||
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
test(function(){
|
||||
var e = newElm();
|
||||
var style = e.style;
|
||||
|
||||
|
||||
style.color = 'red';
|
||||
style.fontSize = '10pt';
|
||||
style.fontWeight = 'bold';
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<link href="http://www.w3.org/TR/cssom/#the-cssrule-interface" rel="help" />
|
||||
<link href="http://www.w3.org/TR/cssom/#the-cssstylerule-interface" rel="help" />
|
||||
<meta content="dom" name="flags" />
|
||||
<meta content="All properties for this CSSStyleRule instance of CSSRule are initialized correctly" name="assert" />
|
||||
<meta content="All properties for this CSSStyleRule instance of CSSRule are initialized correctly" name="assert" />
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
|
|
|
@ -19,12 +19,19 @@ test(function() {
|
|||
}, "String conversion");
|
||||
|
||||
test(function() {
|
||||
assert_throws('InvalidCharacterError', function() { CSS.escape('\0'); });
|
||||
assert_throws('InvalidCharacterError', function() { CSS.escape('a\0'); });
|
||||
assert_throws('InvalidCharacterError', function() { CSS.escape('\0b'); });
|
||||
assert_throws('InvalidCharacterError', function() { CSS.escape('a\0b'); });
|
||||
assert_equals(CSS.escape('\0'), '\uFFFD');
|
||||
assert_equals(CSS.escape('a\0'), 'a\uFFFD');
|
||||
assert_equals(CSS.escape('\0b'), '\uFFFDb');
|
||||
assert_equals(CSS.escape('a\0b'), 'a\uFFFDb');
|
||||
}, "Null bytes");
|
||||
|
||||
test(function() {
|
||||
assert_equals(CSS.escape('\uFFFD'), '\uFFFD');
|
||||
assert_equals(CSS.escape('a\uFFFD'), 'a\uFFFD');
|
||||
assert_equals(CSS.escape('\uFFFDb'), '\uFFFDb');
|
||||
assert_equals(CSS.escape('a\uFFFDb'), 'a\uFFFDb');
|
||||
}, "Replacement character");
|
||||
|
||||
test(function() {
|
||||
assert_equals(CSS.escape('0a'), '\\30 a');
|
||||
assert_equals(CSS.escape('1a'), '\\31 a');
|
||||
|
|
|
@ -7,13 +7,13 @@
|
|||
<meta content="The style value should be serialized to margin: 20px;" name="assert" />
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
</head>
|
||||
<body>
|
||||
<div id="cssomtestElm"></div>
|
||||
<div id="log"></div>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var testElm = document.getElementById('cssomtestElm');
|
||||
// Set the transform
|
||||
// Set the transform
|
||||
document.getElementById('cssomtestElm').style.margin = "20px 20px 20px 20px";
|
||||
|
||||
// Verify that the transform was set as expected
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
<meta content="Testing Serialization of Shorthand Values" name="assert" />
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
</head>
|
||||
<body>
|
||||
<div id="cssomtestElm"></div>
|
||||
<div id="log"></div>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var tests = {
|
||||
'border': [
|
||||
|
@ -56,26 +56,26 @@
|
|||
|
||||
var testElm = document.getElementById('cssomtestElm');
|
||||
for (var test in tests) {
|
||||
|
||||
|
||||
console.log(test);
|
||||
|
||||
if(tests.hasOwnProperty(test)) {
|
||||
results[test] = [];
|
||||
results[test] = [];
|
||||
var propertyTests = tests[test];
|
||||
|
||||
|
||||
for (i = 0; i < propertyTests.length; i++) {
|
||||
document.getElementById('cssomtestElm').setAttribute('style', propertyTests[i][0]);
|
||||
results[test].push([
|
||||
test + ' is expected to be ' + propertyTests[i][1],
|
||||
test + ' is expected to be ' + propertyTests[i][1],
|
||||
document.getElementById('cssomtestElm').style.cssText,
|
||||
propertyTests[i][1]
|
||||
]);
|
||||
}
|
||||
|
||||
generate_tests(assert_equals, results[test]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
|
|
@ -8,17 +8,17 @@
|
|||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<style id="s-0">
|
||||
@namespace svg "http://www.w3.org/2000/svg";
|
||||
@namespace svg "http://www.w3.org/2000/svg";
|
||||
</style>
|
||||
<style id="s-1">
|
||||
@import url('main.css');
|
||||
@import url('main.css');
|
||||
</style>
|
||||
<style id="s-2">
|
||||
<style id="s-2">
|
||||
h1 { background: indianred; }
|
||||
</style>
|
||||
</style>
|
||||
<style id="s-3">
|
||||
@namespace svg "http://www.w3.org/2000/svg";
|
||||
svg|a { color: white; }
|
||||
@namespace svg "http://www.w3.org/2000/svg";
|
||||
svg|a { color: white; }
|
||||
</style>
|
||||
<style id="s-4">
|
||||
@font-face {
|
||||
|
@ -30,7 +30,7 @@
|
|||
url('fonts/megalopolisextra-webfont.svg#MEgalopolisExtraRegular') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<style id="s-5">
|
||||
@media (min-width: 200px) {
|
||||
|
@ -42,14 +42,14 @@
|
|||
h1 { color: #444; }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var stylesheets = document.styleSheets;
|
||||
var ruletypes = {
|
||||
1: 'Style Rule',
|
||||
3: '@import rule',
|
||||
3: '@import rule',
|
||||
4: 'media rule',
|
||||
5: '@font-face rule',
|
||||
6: 'page rule',
|
||||
|
@ -67,28 +67,28 @@
|
|||
's-6': '@page :first'
|
||||
}
|
||||
|
||||
var ruleOrder = [10, 3, 1, 1, 5, 4, 6];
|
||||
var ruleOrder = [10, 3, 1, 1, 5, 4, 6];
|
||||
|
||||
var results = [];
|
||||
|
||||
|
||||
for (i = 0; i < stylesheets.length; i++) {
|
||||
|
||||
for (i = 0; i < stylesheets.length; i++) {
|
||||
if(i == 3) {
|
||||
cssType = stylesheets[i].cssRules.length > 0 && stylesheets[i].cssRules[1] ? stylesheets[i].cssRules[1].type : 11;
|
||||
cssType = stylesheets[i].cssRules.length > 0 && stylesheets[i].cssRules[1] ? stylesheets[i].cssRules[1].type : 11;
|
||||
} else {
|
||||
cssType = stylesheets[i].cssRules.length > 0 ? stylesheets[i].cssRules[0].type : 11;
|
||||
cssType = stylesheets[i].cssRules.length > 0 ? stylesheets[i].cssRules[0].type : 11;
|
||||
}
|
||||
|
||||
|
||||
results.push([
|
||||
ruletypes[ruleOrder[i]] + ' is expected to be ' + types['s-' + i],
|
||||
ruletypes[cssType],
|
||||
ruletypes[ruleOrder[i]]
|
||||
]);
|
||||
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
generate_tests(assert_equals, results);
|
||||
|
||||
generate_tests(assert_equals, results);
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
|
|
@ -41,8 +41,8 @@
|
|||
test(function() {
|
||||
assert_regexp_match(declaration.cssText, /margin-left: 5px;\s*/);
|
||||
assert_equals(declaration.getPropertyValue("margin-left"), "5px");
|
||||
}, "read", {
|
||||
assert: "initial property values are correct"
|
||||
}, "read", {
|
||||
assert: "initial property values are correct"
|
||||
});
|
||||
|
||||
test(function() {
|
||||
|
@ -53,14 +53,14 @@
|
|||
assert_equals(declaration.item(1), "padding-left");
|
||||
assert_equals(declaration.getPropertyValue("margin-left"), "10px");
|
||||
assert_equals(declaration.getPropertyValue("padding-left"), "10px");
|
||||
|
||||
|
||||
var computedStyle = window.getComputedStyle(document.getElementById("test"));
|
||||
assert_equals(computedStyle.getPropertyValue("margin-left"), "10px");
|
||||
assert_equals(computedStyle.getPropertyValue("padding-left"), "10px");
|
||||
}, "csstext_write", {
|
||||
}, "csstext_write", {
|
||||
assert: [ "setting cssText adds new properties",
|
||||
"setting cssText removes existing properties",
|
||||
"properties set through cssText are reflected in the computed style"]
|
||||
"properties set through cssText are reflected in the computed style"]
|
||||
});
|
||||
|
||||
test(function() {
|
||||
|
@ -68,19 +68,19 @@
|
|||
declaration.removeProperty(declaration.item(0));
|
||||
declaration.setProperty("margin-left", "15px");
|
||||
declaration.setProperty("padding-left", "15px");
|
||||
|
||||
|
||||
assert_equals(declaration.length, 2);
|
||||
assert_equals(declaration.item(0), "margin-left");
|
||||
assert_equals(declaration.item(1), "padding-left");
|
||||
assert_equals(declaration.getPropertyValue("margin-left"), "15px");
|
||||
assert_equals(declaration.getPropertyValue("padding-left"), "15px");
|
||||
|
||||
|
||||
var computedStyle = window.getComputedStyle(document.getElementById("test"));
|
||||
assert_equals(computedStyle.getPropertyValue("margin-left"), "15px");
|
||||
assert_equals(computedStyle.getPropertyValue("padding-left"), "15px");
|
||||
}, "property_write", {
|
||||
assert: [ "setProperty adds new properties",
|
||||
"properties set through setProperty are reflected in the computed style"]
|
||||
}, "property_write", {
|
||||
assert: [ "setProperty adds new properties",
|
||||
"properties set through setProperty are reflected in the computed style"]
|
||||
});
|
||||
|
||||
test(function() {
|
||||
|
@ -96,4 +96,5 @@
|
|||
});
|
||||
</script>
|
||||
|
||||
|
||||
</body></html>
|
163
tests/wpt/css-tests/cssom-1_dev/xhtml1/interfaces.xht
Normal file
163
tests/wpt/css-tests/cssom-1_dev/xhtml1/interfaces.xht
Normal file
|
@ -0,0 +1,163 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta charset="utf-8" />
|
||||
<title>CSSOM automated IDL tests</title>
|
||||
<link href="mailto:Ms2ger@gmail.com" rel="author" title="Ms2ger" />
|
||||
<link href="https://drafts.csswg.org/cssom-1/#idl-index" rel="help" />
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/resources/WebIDLParser.js"></script>
|
||||
<script src="/resources/idlharness.js"></script>
|
||||
<style id="styleElement">
|
||||
#test { color: green; }
|
||||
</style>
|
||||
</head><body><div id="log"></div>
|
||||
<script type="text/plain" id="untested_idl">
|
||||
interface EventTarget {};
|
||||
interface Node : EventTarget {};
|
||||
interface Document : Node {};
|
||||
interface ProcessingInstruction : Node {};
|
||||
interface Element : Node {};
|
||||
interface HTMLElement : Element {};
|
||||
interface SVGElement : Element {};
|
||||
[PrimaryGlobal] interface Window {};
|
||||
</script>
|
||||
<script type="text/plain" id="idl">
|
||||
[ArrayClass]interface MediaList {
|
||||
[TreatNullAs=EmptyString] stringifier attribute DOMString mediaText;
|
||||
readonly attribute unsigned long length;
|
||||
getter DOMString? item(unsigned long index);
|
||||
void appendMedium(DOMString medium);
|
||||
void deleteMedium(DOMString medium);
|
||||
};
|
||||
interface StyleSheet {
|
||||
readonly attribute DOMString type;
|
||||
readonly attribute DOMString? href;
|
||||
readonly attribute (Element or ProcessingInstruction)? ownerNode;
|
||||
readonly attribute StyleSheet? parentStyleSheet;
|
||||
readonly attribute DOMString? title;
|
||||
[SameObject, PutForwards=mediaText] readonly attribute MediaList media;
|
||||
attribute boolean disabled;
|
||||
};
|
||||
|
||||
interface CSSStyleSheet : StyleSheet {
|
||||
readonly attribute CSSRule? ownerRule;
|
||||
[SameObject] readonly attribute CSSRuleList cssRules;
|
||||
unsigned long insertRule(DOMString rule, unsigned long index);
|
||||
void deleteRule(unsigned long index);
|
||||
};
|
||||
|
||||
[ArrayClass]interface StyleSheetList {
|
||||
getter StyleSheet? item(unsigned long index);
|
||||
readonly attribute unsigned long length;
|
||||
};
|
||||
partial interface Document { [SameObject] readonly attribute StyleSheetList styleSheets;
|
||||
attribute DOMString? selectedStyleSheetSet;
|
||||
readonly attribute DOMString? lastStyleSheetSet;
|
||||
readonly attribute DOMString? preferredStyleSheetSet;
|
||||
readonly attribute DOMString[] styleSheetSets;
|
||||
void enableStyleSheetsForSet(DOMString? name);
|
||||
};
|
||||
[NoInterfaceObject]interface LinkStyle {
|
||||
readonly attribute StyleSheet? sheet;
|
||||
};
|
||||
ProcessingInstruction implements LinkStyle;
|
||||
[ArrayClass]interface CSSRuleList {
|
||||
getter CSSRule? item(unsigned long index);
|
||||
readonly attribute unsigned long length;
|
||||
};
|
||||
interface CSSRule { const unsigned short STYLE_RULE = 1;
|
||||
const unsigned short CHARSET_RULE = 2; // historical
|
||||
const unsigned short IMPORT_RULE = 3;
|
||||
const unsigned short MEDIA_RULE = 4;
|
||||
const unsigned short FONT_FACE_RULE = 5;
|
||||
const unsigned short PAGE_RULE = 6;
|
||||
const unsigned short MARGIN_RULE = 9;
|
||||
const unsigned short NAMESPACE_RULE = 10;
|
||||
readonly attribute unsigned short type;
|
||||
attribute DOMString cssText;
|
||||
readonly attribute CSSRule? parentRule;
|
||||
readonly attribute CSSStyleSheet? parentStyleSheet;
|
||||
};
|
||||
interface CSSStyleRule : CSSRule { attribute DOMString selectorText;
|
||||
[SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style;
|
||||
};
|
||||
interface CSSImportRule : CSSRule { readonly attribute DOMString href;
|
||||
[SameObject, PutForwards=mediaText] readonly attribute MediaList media;
|
||||
[SameObject] readonly attribute CSSStyleSheet styleSheet;
|
||||
};
|
||||
interface CSSGroupingRule : CSSRule { [SameObject] readonly attribute CSSRuleList cssRules;
|
||||
unsigned long insertRule(DOMString rule, unsigned long index);
|
||||
void deleteRule(unsigned long index);
|
||||
};
|
||||
interface CSSMediaRule : CSSGroupingRule { [SameObject, PutForwards=mediaText] readonly attribute MediaList media;
|
||||
};
|
||||
interface CSSPageRule : CSSGroupingRule { attribute DOMString selectorText;
|
||||
[SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style;
|
||||
};
|
||||
interface CSSMarginRule : CSSRule { readonly attribute DOMString name;
|
||||
[SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style;
|
||||
};
|
||||
interface CSSNamespaceRule : CSSRule { readonly attribute DOMString namespaceURI;
|
||||
readonly attribute DOMString prefix;
|
||||
};
|
||||
interface CSSStyleDeclaration { attribute DOMString cssText;
|
||||
readonly attribute unsigned long length;
|
||||
getter DOMString item(unsigned long index);
|
||||
DOMString getPropertyValue(DOMString property);
|
||||
DOMString getPropertyPriority(DOMString property);
|
||||
void setProperty(DOMString property, [TreatNullAs=EmptyString] DOMString value, [TreatNullAs=EmptyString] optional DOMString priority = "");
|
||||
void setPropertyValue(DOMString property, [TreatNullAs=EmptyString] DOMString value);
|
||||
void setPropertyPriority(DOMString property, [TreatNullAs=EmptyString] DOMString priority);
|
||||
DOMString removeProperty(DOMString property);
|
||||
readonly attribute CSSRule? parentRule;
|
||||
[TreatNullAs=EmptyString] attribute DOMString cssFloat;
|
||||
};
|
||||
partial interface CSSStyleDeclaration { [TreatNullAs=EmptyString] attribute DOMString _camel_cased_attribute;
|
||||
};
|
||||
partial interface CSSStyleDeclaration { [TreatNullAs=EmptyString] attribute DOMString _dashed_attribute;
|
||||
};
|
||||
[NoInterfaceObject]interface ElementCSSInlineStyle {
|
||||
[SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style;
|
||||
};
|
||||
HTMLElement implements ElementCSSInlineStyle;
|
||||
SVGElement implements ElementCSSInlineStyle;
|
||||
partial interface Window { [NewObject] CSSStyleDeclaration getComputedStyle(Element elt, optional DOMString? pseudoElt);
|
||||
};
|
||||
[NoInterfaceObject]interface GetStyleUtils {
|
||||
[SameObject] readonly attribute CSSStyleDeclaration cascadedStyle;
|
||||
[SameObject] readonly attribute CSSStyleDeclaration defaultStyle;
|
||||
[SameObject] readonly attribute CSSStyleDeclaration rawComputedStyle;
|
||||
[SameObject] readonly attribute CSSStyleDeclaration usedStyle;
|
||||
};
|
||||
partial interface Element { PseudoElement? pseudo(DOMString pseudoElt);
|
||||
};
|
||||
|
||||
Element implements GetStyleUtils;
|
||||
interface PseudoElement {
|
||||
};
|
||||
|
||||
PseudoElement implements GetStyleUtils;
|
||||
interface CSS { static DOMString escape(DOMString ident);
|
||||
};
|
||||
</script>
|
||||
<script>
|
||||
var idl_array, style_element;
|
||||
setup(function() {
|
||||
idl_array = new IdlArray();
|
||||
var idls = document.getElementById("idl").textContent;
|
||||
var untested_idls = document.getElementById("untested_idl").textContent;
|
||||
idl_array.add_untested_idls(untested_idls);
|
||||
idl_array.add_idls(idls);
|
||||
|
||||
style_element = document.getElementById('styleElement');
|
||||
idl_array.add_objects({
|
||||
"Document": ["document", "new Document()"],
|
||||
"StyleSheetList": ["document.styleSheets"],
|
||||
"CSSStyleSheet": ["style_element.sheet"],
|
||||
"CSSRuleList": ["style_element.sheet.cssRules"],
|
||||
"CSSStyleRule": ["style_element.sheet.cssRules[0]"],
|
||||
});
|
||||
});
|
||||
idl_array.test();
|
||||
</script>
|
||||
</body></html>
|
|
@ -37,15 +37,15 @@
|
|||
<noscript>Test not run - javascript required.</noscript>
|
||||
<div id="log"></div>
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
var styleElement;
|
||||
var styleSheet;
|
||||
var mediaList;
|
||||
|
||||
|
||||
// Setup
|
||||
function setup() {
|
||||
styleElement = document.getElementById("styleElement");
|
||||
|
||||
|
||||
if (styleElement) {
|
||||
// teardown
|
||||
document.getElementsByTagName("head")[0].removeChild(styleElement);
|
||||
|
@ -53,57 +53,58 @@
|
|||
styleSheet = undefined;
|
||||
mediaList = undefined;
|
||||
}
|
||||
|
||||
|
||||
styleElement = document.createElement("style");
|
||||
styleElement.id = "styleElement";
|
||||
styleElement.type = "text/css";
|
||||
styleElement.media = "all";
|
||||
document.getElementsByTagName("head")[0].appendChild(styleElement);
|
||||
document.getElementsByTagName("head")[0].appendChild(styleElement);
|
||||
styleSheet = styleElement.sheet;
|
||||
mediaList = styleSheet.media;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
test(function() {
|
||||
setup();
|
||||
|
||||
assert_equals(mediaList.mediaText, "all");
|
||||
|
||||
|
||||
assert_equals(mediaList.mediaText, "all");
|
||||
|
||||
}, "mediatest_medialist_serialize_element",
|
||||
{ help: ["http://www.w3.org/TR/cssom/#the-medialist-interface", "http://www.w3.org/TR/cssom/#serializing-media-queries"],
|
||||
assert: ["MediaList.mediaText equals the 'media' value of the initial 'style' element."] });
|
||||
|
||||
test(function() {
|
||||
test(function() {
|
||||
setup();
|
||||
|
||||
|
||||
mediaList.appendMedium('screen');
|
||||
assert_equals(mediaList.mediaText, "all, screen");
|
||||
|
||||
assert_equals(mediaList.mediaText, "all, screen");
|
||||
|
||||
}, "mediatest_medialist_serialize_comma",
|
||||
{ help: ["http://www.w3.org/TR/cssom/#the-medialist-interface", "http://www.w3.org/TR/cssom/#serializing-media-queries"],
|
||||
assert: ["To serialize a comma-separated list concatenate all items of the list in list order while separating them by \",\" (U+002C), followed by a space (U+0020)."] });
|
||||
|
||||
|
||||
test(function() {
|
||||
setup();
|
||||
|
||||
|
||||
mediaList.deleteMedium('all');
|
||||
assert_equals(mediaList.mediaText, "");
|
||||
|
||||
assert_equals(mediaList.mediaText, "");
|
||||
|
||||
}, "mediatest_medialist_serialize_empty",
|
||||
{ help: ["http://www.w3.org/TR/cssom/#the-medialist-interface", "http://www.w3.org/TR/cssom/#serializing-media-queries"],
|
||||
assert: ["If the media query list is empty return the empty string."] });
|
||||
|
||||
|
||||
test(function() {
|
||||
setup();
|
||||
|
||||
|
||||
mediaList.appendMedium('screen');
|
||||
mediaList.appendMedium('print');
|
||||
assert_equals(mediaList.mediaText, "all, print, screen");
|
||||
|
||||
assert_equals(mediaList.mediaText, "all, print, screen");
|
||||
|
||||
}, "mediatest_medialist_serialize_lexicographical",
|
||||
{ help: ["http://www.w3.org/TR/cssom/#the-medialist-interface", "http://www.w3.org/TR/cssom/#serializing-media-queries"],
|
||||
assert: ["Each media query in the list of media queries should be sorted in lexicographical order."] });
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
</body></html>
|
|
@ -23,15 +23,15 @@
|
|||
<noscript>Test not run - javascript required.</noscript>
|
||||
<div id="log"></div>
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
var styleElement;
|
||||
var styleSheet;
|
||||
var mediaList;
|
||||
|
||||
|
||||
// Setup - accepts media value for style element, e.g. <style media=???">
|
||||
function setupMedia(media) {
|
||||
styleElement = document.getElementById("styleElement");
|
||||
|
||||
|
||||
if (styleElement) {
|
||||
// teardown
|
||||
document.getElementsByTagName("head")[0].removeChild(styleElement);
|
||||
|
@ -39,33 +39,34 @@
|
|||
styleSheet = undefined;
|
||||
mediaList = undefined;
|
||||
}
|
||||
|
||||
|
||||
styleElement = document.createElement("style");
|
||||
styleElement.id = "styleElement";
|
||||
styleElement.type = "text/css";
|
||||
styleElement.media = media;
|
||||
document.getElementsByTagName("head")[0].appendChild(styleElement);
|
||||
document.getElementsByTagName("head")[0].appendChild(styleElement);
|
||||
styleSheet = styleElement.sheet;
|
||||
mediaList = styleSheet.media;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
test(function() {
|
||||
setupMedia('not screen and (min-WIDTH:5px) AND (max-width:40px )');
|
||||
|
||||
assert_equals(mediaList.mediaText, "not screen and (max-width: 40px) and (min-width: 5px)");
|
||||
|
||||
|
||||
assert_equals(mediaList.mediaText, "not screen and (max-width: 40px) and (min-width: 5px)");
|
||||
|
||||
}, "mediatest_mediaquery_serialize_1",
|
||||
{ assert: ["First explicit example input (first column) and output (second column) in specification."] });
|
||||
|
||||
test(function() {
|
||||
setupMedia('all and (color) and (color) ');
|
||||
|
||||
assert_equals(mediaList.mediaText, "(color)");
|
||||
assert_equals(mediaList.mediaText, "(color)");
|
||||
|
||||
}, "mediatest_mediaquery_serialize_2",
|
||||
{ assert: ["Second explicit example input (first column) and output (second column) in specification."] });
|
||||
|
||||
{ assert: ["Second explicit example input (first column) and output (second column) in specification."] });
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
</body></html>
|
|
@ -65,7 +65,7 @@
|
|||
assert_own_property(styleSheet, "cssRules");
|
||||
assert_inherits(styleSheet, "insertRule");
|
||||
assert_inherits(styleSheet, "deleteRule");
|
||||
|
||||
|
||||
assert_readonly(styleSheet, "ownerRule");
|
||||
assert_readonly(styleSheet, "cssRules");
|
||||
}, "CSSStyleSheet_properties",
|
||||
|
@ -113,7 +113,7 @@
|
|||
assert_equals(styleSheet.href, null);
|
||||
assert_regexp_match(linkSheet.href, /support\/b-green.css$/);
|
||||
assert_regexp_match(importSheet.href, /support\/a-green.css$/);
|
||||
|
||||
|
||||
assert_equals(styleSheet.parentStyleSheet, null);
|
||||
assert_equals(linkSheet.parentStyleSheet, null);
|
||||
assert_equals(importSheet.parentStyleSheet, styleSheet);
|
||||
|
@ -124,4 +124,5 @@
|
|||
{ assert: "StyleSheet initial property values are correct" });
|
||||
</script>
|
||||
|
||||
|
||||
</body></html>
|
|
@ -36,7 +36,7 @@
|
|||
assert: [ "Initial rule list is of size 1",
|
||||
"Can add a rule at first index" ]
|
||||
});
|
||||
|
||||
|
||||
test(function() {
|
||||
sheet.deleteRule(0);
|
||||
assert_equals(sheet.cssRules.length, 1);
|
||||
|
|
|
@ -39,10 +39,10 @@
|
|||
var outer = document.getElementById("outside");
|
||||
var inner = document.getElementById("inside");
|
||||
var innerStyle;
|
||||
|
||||
|
||||
test(function() {
|
||||
innerStyle = window.getComputedStyle(inner);
|
||||
assert_throws( "NO_MODIFICATION_ALLOWED_ERR",
|
||||
assert_throws( "NO_MODIFICATION_ALLOWED_ERR",
|
||||
function() { innerStyle.cssText = "color: blue;"; },
|
||||
"do not allow setting cssText on a readonly CSSStyleDeclaration");
|
||||
assert_throws( "NO_MODIFICATION_ALLOWED_ERR",
|
||||
|
@ -51,10 +51,10 @@
|
|||
assert_throws( "NO_MODIFICATION_ALLOWED_ERR",
|
||||
function() { innerStyle.color = "blue"; },
|
||||
"do not allow setting a property on a readonly CSSStyleDeclaration");
|
||||
}, "read_only", {
|
||||
}, "read_only", {
|
||||
assert: "do not allow modifications to a computed CSSStyleDeclaration"
|
||||
});
|
||||
|
||||
|
||||
test(function() {
|
||||
assert_equals(innerStyle.getPropertyValue("height"), "100px");
|
||||
}, "property_values", {
|
||||
|
@ -66,7 +66,7 @@
|
|||
}, "inherited_property_values", {
|
||||
assert: "Inherited properties are resolved"
|
||||
});
|
||||
|
||||
|
||||
test(function() {
|
||||
assert_equals(innerStyle.getPropertyValue("width"), "100px");
|
||||
}, "relative_property_values", {
|
||||
|
|
|
@ -10,87 +10,54 @@
|
|||
<style id="styleElement">
|
||||
#test { color: green; }
|
||||
</style>
|
||||
<script id="metadata_cache">/*
|
||||
{
|
||||
"CSSStyleDeclaration_accessible": {
|
||||
"help": ["http://www.w3.org/TR/cssom/#the-cssstylesheet-interface",
|
||||
"http://www.w3.org/TR/cssom/#the-cssrulelist-interface",
|
||||
"http://www.w3.org/TR/cssom/#the-cssstylerule-interface"],
|
||||
"assert": "Can access CSSStyleDeclaration through CSSOM"
|
||||
},
|
||||
"read": { "assert": "initial property values are correct" },
|
||||
"csstext_write": {
|
||||
"assert": ["setting cssText adds new properties",
|
||||
"setting cssText removes existing properties",
|
||||
"properties set through cssText are reflected in the computed style"]
|
||||
},
|
||||
"property_write": {
|
||||
"assert": ["setProperty adds new properties",
|
||||
"properties set through setProperty are reflected in the computed style"]
|
||||
}
|
||||
}
|
||||
*/</script>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>Test not run - javascript required.</noscript>
|
||||
<div id="log"></div>
|
||||
<div id="test"></div>
|
||||
<script type="text/javascript">
|
||||
var styleElement = document.getElementById("styleElement");
|
||||
var styleDeclaration;
|
||||
test(function() {
|
||||
assert_own_property(styleElement, "sheet");
|
||||
assert_own_property(styleElement.sheet, "cssRules");
|
||||
assert_true(styleElement.sheet.cssRules instanceof CSSRuleList);
|
||||
assert_true(styleElement.sheet.cssRules.item(0) instanceof CSSStyleRule);
|
||||
declaration = styleElement.sheet.cssRules.item(0).style;
|
||||
}, "CSSStyleDeclaration_accessible",
|
||||
{ help: [ "http://www.w3.org/TR/cssom/#the-cssstylesheet-interface",
|
||||
"http://www.w3.org/TR/cssom/#the-cssrulelist-interface",
|
||||
"http://www.w3.org/TR/cssom/#the-cssstylerule-interface" ],
|
||||
assert: "Can access CSSStyleDeclaration through CSSOM" });
|
||||
var declaration;
|
||||
setup(function() {
|
||||
var styleElement = document.getElementById("styleElement");
|
||||
declaration = styleElement.sheet.cssRules.item(0).style;
|
||||
});
|
||||
|
||||
test(function() {
|
||||
assert_regexp_match(declaration.cssText, /color: green;\s*/);
|
||||
test(function() {
|
||||
assert_equals(declaration.cssText, "color: green;");
|
||||
assert_equals(declaration.getPropertyValue("color"), "green");
|
||||
}, "read",
|
||||
{ assert: "initial property values are correct" });
|
||||
}, "Reading CSSStyleDeclaration initialized from a style element");
|
||||
|
||||
test(function() {
|
||||
declaration.cssText = "margin-left: 10px; padding-left: 10px;";
|
||||
assert_regexp_match(declaration.cssText, /margin-left: 10px;\s+padding-left: 10px;\s+/);
|
||||
declaration.cssText = "margin-left:10px; padding-left:10px";
|
||||
assert_equals(declaration.cssText, "margin-left: 10px; padding-left: 10px;");
|
||||
assert_equals(declaration.length, 2);
|
||||
assert_equals(declaration.item(0), "margin-left");
|
||||
assert_equals(declaration.item(1), "padding-left");
|
||||
assert_equals(declaration.getPropertyValue("margin-left"), "10px");
|
||||
assert_equals(declaration.getPropertyValue("padding-left"), "10px");
|
||||
|
||||
|
||||
var computedStyle = window.getComputedStyle(document.getElementById("test"));
|
||||
assert_equals(computedStyle.getPropertyValue("margin-left"), "10px");
|
||||
assert_equals(computedStyle.getPropertyValue("padding-left"), "10px");
|
||||
}, "csstext_write",
|
||||
{ assert: [ "setting cssText adds new properties",
|
||||
"setting cssText removes existing properties",
|
||||
"properties set through cssText are reflected in the computed style"] });
|
||||
}, "Setting CSSStyleDeclaration#cssText");
|
||||
|
||||
test(function() {
|
||||
while(declaration.length > 0)
|
||||
while (declaration.length > 0) {
|
||||
declaration.removeProperty(declaration.item(0));
|
||||
}
|
||||
declaration.setProperty("margin-left", "15px");
|
||||
declaration.setProperty("padding-left", "15px");
|
||||
|
||||
|
||||
assert_equals(declaration.length, 2);
|
||||
assert_equals(declaration.item(0), "margin-left");
|
||||
assert_equals(declaration.item(1), "padding-left");
|
||||
assert_equals(declaration.getPropertyValue("margin-left"), "15px");
|
||||
assert_equals(declaration.getPropertyValue("padding-left"), "15px");
|
||||
|
||||
|
||||
var computedStyle = window.getComputedStyle(document.getElementById("test"));
|
||||
assert_equals(computedStyle.getPropertyValue("margin-left"), "15px");
|
||||
assert_equals(computedStyle.getPropertyValue("padding-left"), "15px");
|
||||
}, "property_write",
|
||||
{ assert: [ "setProperty adds new properties",
|
||||
"properties set through setProperty are reflected in the computed style"] });
|
||||
}, "Calling CSSStyleDeclaration#setProperty");
|
||||
</script>
|
||||
|
||||
|
||||
</body></html>
|
|
@ -6,51 +6,33 @@
|
|||
<link href="http://www.w3.org/TR/cssom/#the-cssrule-interface" rel="help" />
|
||||
<link href="http://www.w3.org/TR/cssom/#the-cssimportrule-interface" rel="help" />
|
||||
<meta content="dom" name="flags" />
|
||||
<meta content="All properties for this CSSImportRule instance of CSSRule are initialized correctly" name="assert" />
|
||||
<meta content="All properties for this CSSImportRule instance of CSSRule are initialized correctly" name="assert" />
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
|
||||
<style type="text/css" id="styleElement">
|
||||
@import url("support/a-green.css");
|
||||
@import url("support/a-green.css") screen;
|
||||
</style>
|
||||
|
||||
<script id="metadata_cache">/*
|
||||
{
|
||||
"CSSRule and CSSImportRule types": { "assert": "rule is an instance of CSSRule and CSSImportRule" },
|
||||
"Rule_type_property": { "assert": "CSSRule type property has correct type and constants" },
|
||||
"CSSRule_properties": {
|
||||
"assert": ["cssText, parentRule, parentStyleSheet properties exist on CSSRule",
|
||||
"type, parentRule, parentStyleSheet properties on CSSRule are readonly"]
|
||||
},
|
||||
"CSSRule_properties_values": { "assert": "type, parentRule, parentStyleSheet initial property values on CSSRule are correct" },
|
||||
"CSSImportRule_properties": {
|
||||
"assert": ["href, media, styleSheet properties exist on CSSImportsRule",
|
||||
"href, media, styleSheet properties are readonly"]
|
||||
},
|
||||
"CSSImportRule_properties_values": { "assert": "Initial values of href, media, styleSheet properties on CSSImportRule are correct" }
|
||||
}
|
||||
*/</script>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>Test not run -- JavaScript required.</noscript>
|
||||
<div id="log"></div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var styleSheet = document.getElementById("styleElement").sheet;
|
||||
var ruleList = styleSheet.cssRules;
|
||||
|
||||
var rule = ruleList[0];
|
||||
var ruleWithMedia = ruleList[1];
|
||||
var rule, ruleWithMedia;
|
||||
setup(function() {
|
||||
var styleSheet = document.getElementById("styleElement").sheet;
|
||||
var ruleList = styleSheet.cssRules;
|
||||
rule = ruleList[0];
|
||||
ruleWithMedia = ruleList[1];
|
||||
});
|
||||
|
||||
test(function() {
|
||||
assert_true(rule instanceof CSSRule);
|
||||
assert_true(rule instanceof CSSImportRule);
|
||||
assert_true(ruleWithMedia instanceof CSSRule);
|
||||
assert_true(ruleWithMedia instanceof CSSImportRule);
|
||||
}, "CSSRule and CSSImportRule types",
|
||||
{ assert: "rule is an instance of CSSRule and CSSImportRule" }
|
||||
);
|
||||
}, "CSSRule and CSSImportRule types");
|
||||
|
||||
test(function() {
|
||||
assert_equals(rule.STYLE_RULE, 1);
|
||||
|
@ -59,47 +41,39 @@
|
|||
assert_equals(rule.FONT_FACE_RULE, 5);
|
||||
assert_equals(rule.PAGE_RULE, 6);
|
||||
assert_equals(rule.NAMESPACE_RULE, 10);
|
||||
assert_own_property(rule, "type");
|
||||
assert_true(typeof rule.type === "number");
|
||||
}, "Rule_type_property",
|
||||
{ assert: "CSSRule type property has correct type and constants" }
|
||||
);
|
||||
assert_idl_attribute(rule, "type");
|
||||
assert_equals(typeof rule.type, "number");
|
||||
}, "Type of CSSRule#type and constant values");
|
||||
|
||||
test(function() {
|
||||
assert_true(rule instanceof CSSRule);
|
||||
assert_own_property(rule, "cssText");
|
||||
assert_own_property(rule, "parentRule");
|
||||
assert_own_property(rule, "parentStyleSheet");
|
||||
assert_idl_attribute(rule, "cssText");
|
||||
assert_idl_attribute(rule, "parentRule");
|
||||
assert_idl_attribute(rule, "parentStyleSheet");
|
||||
|
||||
assert_readonly(rule, "type");
|
||||
assert_readonly(rule, "parentRule");
|
||||
assert_readonly(rule, "parentStyleSheet");
|
||||
}, "CSSRule_properties",
|
||||
{ assert: ["cssText, parentRule, parentStyleSheet properties exist on CSSRule", "type, parentRule, parentStyleSheet properties on CSSRule are readonly"] }
|
||||
);
|
||||
}, "Existence and writability of CSSRule attributes");
|
||||
|
||||
test(function() {
|
||||
assert_equals(rule.type, rule.IMPORT_RULE);
|
||||
assert_equals(typeof rule.cssText, "string");
|
||||
assert_equals(rule.cssText, "@import url(\"cssimportrule.css\");");
|
||||
assert_equals(ruleWithMedia.cssText, "@import url(\"cssimportrule.css\") screen;");
|
||||
assert_equals(rule.cssText, '@import url("support/a-green.css");');
|
||||
assert_equals(ruleWithMedia.cssText, '@import url("support/a-green.css") screen;');
|
||||
assert_equals(rule.parentRule, null);
|
||||
assert_true(rule.parentStyleSheet instanceof CSSStyleSheet);
|
||||
}, "CSSRule_properties_values",
|
||||
{ assert: "type, parentRule, parentStyleSheet initial property values on CSSRule are correct" }
|
||||
);
|
||||
}, "Values of CSSRule attributes");
|
||||
|
||||
test(function() {
|
||||
assert_own_property(rule, "href");
|
||||
assert_own_property(rule, "media");
|
||||
assert_own_property(rule, "styleSheet");
|
||||
assert_idl_attribute(rule, "href");
|
||||
assert_idl_attribute(rule, "media");
|
||||
assert_idl_attribute(rule, "styleSheet");
|
||||
|
||||
assert_readonly(rule, "href");
|
||||
assert_readonly(rule, "media");
|
||||
assert_readonly(rule, "styleSheet");
|
||||
}, "CSSImportRule_properties",
|
||||
{ assert: ["href, media, styleSheet properties exist on CSSImportsRule", "href, media, styleSheet properties are readonly"] }
|
||||
);
|
||||
}, "Existence and writability of CSSImportRule attributes");
|
||||
|
||||
test(function() {
|
||||
assert_equals(typeof rule.href, "string");
|
||||
|
@ -107,10 +81,7 @@
|
|||
assert_true(rule.styleSheet instanceof CSSStyleSheet);
|
||||
assert_true(ruleWithMedia.media.length > 0);
|
||||
assert_equals(ruleWithMedia.media.mediaText, "screen");
|
||||
}, "CSSImportRule_properties_values",
|
||||
{ assert: "Initial values of href, media, styleSheet properties on CSSImportRule are correct" }
|
||||
);
|
||||
|
||||
}, "Values of CSSImportRule attributes");
|
||||
</script>
|
||||
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
test(function(){
|
||||
var e = newElm();
|
||||
var style = e.style;
|
||||
|
||||
|
||||
style.color = 'red';
|
||||
style.fontSize = '10pt';
|
||||
style.fontWeight = 'bold';
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<link href="http://www.w3.org/TR/cssom/#the-cssrule-interface" rel="help" />
|
||||
<link href="http://www.w3.org/TR/cssom/#the-cssstylerule-interface" rel="help" />
|
||||
<meta content="dom" name="flags" />
|
||||
<meta content="All properties for this CSSStyleRule instance of CSSRule are initialized correctly" name="assert" />
|
||||
<meta content="All properties for this CSSStyleRule instance of CSSRule are initialized correctly" name="assert" />
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
|
|
|
@ -19,12 +19,19 @@ test(function() {
|
|||
}, "String conversion");
|
||||
|
||||
test(function() {
|
||||
assert_throws('InvalidCharacterError', function() { CSS.escape('\0'); });
|
||||
assert_throws('InvalidCharacterError', function() { CSS.escape('a\0'); });
|
||||
assert_throws('InvalidCharacterError', function() { CSS.escape('\0b'); });
|
||||
assert_throws('InvalidCharacterError', function() { CSS.escape('a\0b'); });
|
||||
assert_equals(CSS.escape('\0'), '\uFFFD');
|
||||
assert_equals(CSS.escape('a\0'), 'a\uFFFD');
|
||||
assert_equals(CSS.escape('\0b'), '\uFFFDb');
|
||||
assert_equals(CSS.escape('a\0b'), 'a\uFFFDb');
|
||||
}, "Null bytes");
|
||||
|
||||
test(function() {
|
||||
assert_equals(CSS.escape('\uFFFD'), '\uFFFD');
|
||||
assert_equals(CSS.escape('a\uFFFD'), 'a\uFFFD');
|
||||
assert_equals(CSS.escape('\uFFFDb'), '\uFFFDb');
|
||||
assert_equals(CSS.escape('a\uFFFDb'), 'a\uFFFDb');
|
||||
}, "Replacement character");
|
||||
|
||||
test(function() {
|
||||
assert_equals(CSS.escape('0a'), '\\30 a');
|
||||
assert_equals(CSS.escape('1a'), '\\31 a');
|
||||
|
|
|
@ -7,13 +7,13 @@
|
|||
<meta content="The style value should be serialized to margin: 20px;" name="assert" />
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
</head>
|
||||
<body>
|
||||
<div id="cssomtestElm"></div>
|
||||
<div id="log"></div>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var testElm = document.getElementById('cssomtestElm');
|
||||
// Set the transform
|
||||
// Set the transform
|
||||
document.getElementById('cssomtestElm').style.margin = "20px 20px 20px 20px";
|
||||
|
||||
// Verify that the transform was set as expected
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
<meta content="Testing Serialization of Shorthand Values" name="assert" />
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
</head>
|
||||
<body>
|
||||
<div id="cssomtestElm"></div>
|
||||
<div id="log"></div>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var tests = {
|
||||
'border': [
|
||||
|
@ -56,26 +56,26 @@
|
|||
|
||||
var testElm = document.getElementById('cssomtestElm');
|
||||
for (var test in tests) {
|
||||
|
||||
|
||||
console.log(test);
|
||||
|
||||
if(tests.hasOwnProperty(test)) {
|
||||
results[test] = [];
|
||||
results[test] = [];
|
||||
var propertyTests = tests[test];
|
||||
|
||||
|
||||
for (i = 0; i < propertyTests.length; i++) {
|
||||
document.getElementById('cssomtestElm').setAttribute('style', propertyTests[i][0]);
|
||||
results[test].push([
|
||||
test + ' is expected to be ' + propertyTests[i][1],
|
||||
test + ' is expected to be ' + propertyTests[i][1],
|
||||
document.getElementById('cssomtestElm').style.cssText,
|
||||
propertyTests[i][1]
|
||||
]);
|
||||
}
|
||||
|
||||
generate_tests(assert_equals, results[test]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
|
|
@ -8,17 +8,17 @@
|
|||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<style id="s-0">
|
||||
@namespace svg "http://www.w3.org/2000/svg";
|
||||
@namespace svg "http://www.w3.org/2000/svg";
|
||||
</style>
|
||||
<style id="s-1">
|
||||
@import url('main.css');
|
||||
@import url('main.css');
|
||||
</style>
|
||||
<style id="s-2">
|
||||
<style id="s-2">
|
||||
h1 { background: indianred; }
|
||||
</style>
|
||||
</style>
|
||||
<style id="s-3">
|
||||
@namespace svg "http://www.w3.org/2000/svg";
|
||||
svg|a { color: white; }
|
||||
@namespace svg "http://www.w3.org/2000/svg";
|
||||
svg|a { color: white; }
|
||||
</style>
|
||||
<style id="s-4">
|
||||
@font-face {
|
||||
|
@ -30,7 +30,7 @@
|
|||
url('fonts/megalopolisextra-webfont.svg#MEgalopolisExtraRegular') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<style id="s-5">
|
||||
@media (min-width: 200px) {
|
||||
|
@ -42,14 +42,14 @@
|
|||
h1 { color: #444; }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var stylesheets = document.styleSheets;
|
||||
var ruletypes = {
|
||||
1: 'Style Rule',
|
||||
3: '@import rule',
|
||||
3: '@import rule',
|
||||
4: 'media rule',
|
||||
5: '@font-face rule',
|
||||
6: 'page rule',
|
||||
|
@ -67,28 +67,28 @@
|
|||
's-6': '@page :first'
|
||||
}
|
||||
|
||||
var ruleOrder = [10, 3, 1, 1, 5, 4, 6];
|
||||
var ruleOrder = [10, 3, 1, 1, 5, 4, 6];
|
||||
|
||||
var results = [];
|
||||
|
||||
|
||||
for (i = 0; i < stylesheets.length; i++) {
|
||||
|
||||
for (i = 0; i < stylesheets.length; i++) {
|
||||
if(i == 3) {
|
||||
cssType = stylesheets[i].cssRules.length > 0 && stylesheets[i].cssRules[1] ? stylesheets[i].cssRules[1].type : 11;
|
||||
cssType = stylesheets[i].cssRules.length > 0 && stylesheets[i].cssRules[1] ? stylesheets[i].cssRules[1].type : 11;
|
||||
} else {
|
||||
cssType = stylesheets[i].cssRules.length > 0 ? stylesheets[i].cssRules[0].type : 11;
|
||||
cssType = stylesheets[i].cssRules.length > 0 ? stylesheets[i].cssRules[0].type : 11;
|
||||
}
|
||||
|
||||
|
||||
results.push([
|
||||
ruletypes[ruleOrder[i]] + ' is expected to be ' + types['s-' + i],
|
||||
ruletypes[cssType],
|
||||
ruletypes[ruleOrder[i]]
|
||||
]);
|
||||
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
generate_tests(assert_equals, results);
|
||||
|
||||
generate_tests(assert_equals, results);
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
|
|
@ -41,8 +41,8 @@
|
|||
test(function() {
|
||||
assert_regexp_match(declaration.cssText, /margin-left: 5px;\s*/);
|
||||
assert_equals(declaration.getPropertyValue("margin-left"), "5px");
|
||||
}, "read", {
|
||||
assert: "initial property values are correct"
|
||||
}, "read", {
|
||||
assert: "initial property values are correct"
|
||||
});
|
||||
|
||||
test(function() {
|
||||
|
@ -53,14 +53,14 @@
|
|||
assert_equals(declaration.item(1), "padding-left");
|
||||
assert_equals(declaration.getPropertyValue("margin-left"), "10px");
|
||||
assert_equals(declaration.getPropertyValue("padding-left"), "10px");
|
||||
|
||||
|
||||
var computedStyle = window.getComputedStyle(document.getElementById("test"));
|
||||
assert_equals(computedStyle.getPropertyValue("margin-left"), "10px");
|
||||
assert_equals(computedStyle.getPropertyValue("padding-left"), "10px");
|
||||
}, "csstext_write", {
|
||||
}, "csstext_write", {
|
||||
assert: [ "setting cssText adds new properties",
|
||||
"setting cssText removes existing properties",
|
||||
"properties set through cssText are reflected in the computed style"]
|
||||
"properties set through cssText are reflected in the computed style"]
|
||||
});
|
||||
|
||||
test(function() {
|
||||
|
@ -68,19 +68,19 @@
|
|||
declaration.removeProperty(declaration.item(0));
|
||||
declaration.setProperty("margin-left", "15px");
|
||||
declaration.setProperty("padding-left", "15px");
|
||||
|
||||
|
||||
assert_equals(declaration.length, 2);
|
||||
assert_equals(declaration.item(0), "margin-left");
|
||||
assert_equals(declaration.item(1), "padding-left");
|
||||
assert_equals(declaration.getPropertyValue("margin-left"), "15px");
|
||||
assert_equals(declaration.getPropertyValue("padding-left"), "15px");
|
||||
|
||||
|
||||
var computedStyle = window.getComputedStyle(document.getElementById("test"));
|
||||
assert_equals(computedStyle.getPropertyValue("margin-left"), "15px");
|
||||
assert_equals(computedStyle.getPropertyValue("padding-left"), "15px");
|
||||
}, "property_write", {
|
||||
assert: [ "setProperty adds new properties",
|
||||
"properties set through setProperty are reflected in the computed style"]
|
||||
}, "property_write", {
|
||||
assert: [ "setProperty adds new properties",
|
||||
"properties set through setProperty are reflected in the computed style"]
|
||||
});
|
||||
|
||||
test(function() {
|
||||
|
@ -96,4 +96,5 @@
|
|||
});
|
||||
</script>
|
||||
|
||||
|
||||
</body></html>
|
163
tests/wpt/css-tests/cssom-1_dev/xhtml1print/interfaces.xht
Normal file
163
tests/wpt/css-tests/cssom-1_dev/xhtml1print/interfaces.xht
Normal file
|
@ -0,0 +1,163 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta charset="utf-8" />
|
||||
<title>CSSOM automated IDL tests</title>
|
||||
<link href="mailto:Ms2ger@gmail.com" rel="author" title="Ms2ger" />
|
||||
<link href="https://drafts.csswg.org/cssom-1/#idl-index" rel="help" />
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/resources/WebIDLParser.js"></script>
|
||||
<script src="/resources/idlharness.js"></script>
|
||||
<style id="styleElement">
|
||||
#test { color: green; }
|
||||
</style>
|
||||
</head><body><div id="log"></div>
|
||||
<script type="text/plain" id="untested_idl">
|
||||
interface EventTarget {};
|
||||
interface Node : EventTarget {};
|
||||
interface Document : Node {};
|
||||
interface ProcessingInstruction : Node {};
|
||||
interface Element : Node {};
|
||||
interface HTMLElement : Element {};
|
||||
interface SVGElement : Element {};
|
||||
[PrimaryGlobal] interface Window {};
|
||||
</script>
|
||||
<script type="text/plain" id="idl">
|
||||
[ArrayClass]interface MediaList {
|
||||
[TreatNullAs=EmptyString] stringifier attribute DOMString mediaText;
|
||||
readonly attribute unsigned long length;
|
||||
getter DOMString? item(unsigned long index);
|
||||
void appendMedium(DOMString medium);
|
||||
void deleteMedium(DOMString medium);
|
||||
};
|
||||
interface StyleSheet {
|
||||
readonly attribute DOMString type;
|
||||
readonly attribute DOMString? href;
|
||||
readonly attribute (Element or ProcessingInstruction)? ownerNode;
|
||||
readonly attribute StyleSheet? parentStyleSheet;
|
||||
readonly attribute DOMString? title;
|
||||
[SameObject, PutForwards=mediaText] readonly attribute MediaList media;
|
||||
attribute boolean disabled;
|
||||
};
|
||||
|
||||
interface CSSStyleSheet : StyleSheet {
|
||||
readonly attribute CSSRule? ownerRule;
|
||||
[SameObject] readonly attribute CSSRuleList cssRules;
|
||||
unsigned long insertRule(DOMString rule, unsigned long index);
|
||||
void deleteRule(unsigned long index);
|
||||
};
|
||||
|
||||
[ArrayClass]interface StyleSheetList {
|
||||
getter StyleSheet? item(unsigned long index);
|
||||
readonly attribute unsigned long length;
|
||||
};
|
||||
partial interface Document { [SameObject] readonly attribute StyleSheetList styleSheets;
|
||||
attribute DOMString? selectedStyleSheetSet;
|
||||
readonly attribute DOMString? lastStyleSheetSet;
|
||||
readonly attribute DOMString? preferredStyleSheetSet;
|
||||
readonly attribute DOMString[] styleSheetSets;
|
||||
void enableStyleSheetsForSet(DOMString? name);
|
||||
};
|
||||
[NoInterfaceObject]interface LinkStyle {
|
||||
readonly attribute StyleSheet? sheet;
|
||||
};
|
||||
ProcessingInstruction implements LinkStyle;
|
||||
[ArrayClass]interface CSSRuleList {
|
||||
getter CSSRule? item(unsigned long index);
|
||||
readonly attribute unsigned long length;
|
||||
};
|
||||
interface CSSRule { const unsigned short STYLE_RULE = 1;
|
||||
const unsigned short CHARSET_RULE = 2; // historical
|
||||
const unsigned short IMPORT_RULE = 3;
|
||||
const unsigned short MEDIA_RULE = 4;
|
||||
const unsigned short FONT_FACE_RULE = 5;
|
||||
const unsigned short PAGE_RULE = 6;
|
||||
const unsigned short MARGIN_RULE = 9;
|
||||
const unsigned short NAMESPACE_RULE = 10;
|
||||
readonly attribute unsigned short type;
|
||||
attribute DOMString cssText;
|
||||
readonly attribute CSSRule? parentRule;
|
||||
readonly attribute CSSStyleSheet? parentStyleSheet;
|
||||
};
|
||||
interface CSSStyleRule : CSSRule { attribute DOMString selectorText;
|
||||
[SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style;
|
||||
};
|
||||
interface CSSImportRule : CSSRule { readonly attribute DOMString href;
|
||||
[SameObject, PutForwards=mediaText] readonly attribute MediaList media;
|
||||
[SameObject] readonly attribute CSSStyleSheet styleSheet;
|
||||
};
|
||||
interface CSSGroupingRule : CSSRule { [SameObject] readonly attribute CSSRuleList cssRules;
|
||||
unsigned long insertRule(DOMString rule, unsigned long index);
|
||||
void deleteRule(unsigned long index);
|
||||
};
|
||||
interface CSSMediaRule : CSSGroupingRule { [SameObject, PutForwards=mediaText] readonly attribute MediaList media;
|
||||
};
|
||||
interface CSSPageRule : CSSGroupingRule { attribute DOMString selectorText;
|
||||
[SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style;
|
||||
};
|
||||
interface CSSMarginRule : CSSRule { readonly attribute DOMString name;
|
||||
[SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style;
|
||||
};
|
||||
interface CSSNamespaceRule : CSSRule { readonly attribute DOMString namespaceURI;
|
||||
readonly attribute DOMString prefix;
|
||||
};
|
||||
interface CSSStyleDeclaration { attribute DOMString cssText;
|
||||
readonly attribute unsigned long length;
|
||||
getter DOMString item(unsigned long index);
|
||||
DOMString getPropertyValue(DOMString property);
|
||||
DOMString getPropertyPriority(DOMString property);
|
||||
void setProperty(DOMString property, [TreatNullAs=EmptyString] DOMString value, [TreatNullAs=EmptyString] optional DOMString priority = "");
|
||||
void setPropertyValue(DOMString property, [TreatNullAs=EmptyString] DOMString value);
|
||||
void setPropertyPriority(DOMString property, [TreatNullAs=EmptyString] DOMString priority);
|
||||
DOMString removeProperty(DOMString property);
|
||||
readonly attribute CSSRule? parentRule;
|
||||
[TreatNullAs=EmptyString] attribute DOMString cssFloat;
|
||||
};
|
||||
partial interface CSSStyleDeclaration { [TreatNullAs=EmptyString] attribute DOMString _camel_cased_attribute;
|
||||
};
|
||||
partial interface CSSStyleDeclaration { [TreatNullAs=EmptyString] attribute DOMString _dashed_attribute;
|
||||
};
|
||||
[NoInterfaceObject]interface ElementCSSInlineStyle {
|
||||
[SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style;
|
||||
};
|
||||
HTMLElement implements ElementCSSInlineStyle;
|
||||
SVGElement implements ElementCSSInlineStyle;
|
||||
partial interface Window { [NewObject] CSSStyleDeclaration getComputedStyle(Element elt, optional DOMString? pseudoElt);
|
||||
};
|
||||
[NoInterfaceObject]interface GetStyleUtils {
|
||||
[SameObject] readonly attribute CSSStyleDeclaration cascadedStyle;
|
||||
[SameObject] readonly attribute CSSStyleDeclaration defaultStyle;
|
||||
[SameObject] readonly attribute CSSStyleDeclaration rawComputedStyle;
|
||||
[SameObject] readonly attribute CSSStyleDeclaration usedStyle;
|
||||
};
|
||||
partial interface Element { PseudoElement? pseudo(DOMString pseudoElt);
|
||||
};
|
||||
|
||||
Element implements GetStyleUtils;
|
||||
interface PseudoElement {
|
||||
};
|
||||
|
||||
PseudoElement implements GetStyleUtils;
|
||||
interface CSS { static DOMString escape(DOMString ident);
|
||||
};
|
||||
</script>
|
||||
<script>
|
||||
var idl_array, style_element;
|
||||
setup(function() {
|
||||
idl_array = new IdlArray();
|
||||
var idls = document.getElementById("idl").textContent;
|
||||
var untested_idls = document.getElementById("untested_idl").textContent;
|
||||
idl_array.add_untested_idls(untested_idls);
|
||||
idl_array.add_idls(idls);
|
||||
|
||||
style_element = document.getElementById('styleElement');
|
||||
idl_array.add_objects({
|
||||
"Document": ["document", "new Document()"],
|
||||
"StyleSheetList": ["document.styleSheets"],
|
||||
"CSSStyleSheet": ["style_element.sheet"],
|
||||
"CSSRuleList": ["style_element.sheet.cssRules"],
|
||||
"CSSStyleRule": ["style_element.sheet.cssRules[0]"],
|
||||
});
|
||||
});
|
||||
idl_array.test();
|
||||
</script>
|
||||
</body></html>
|
|
@ -37,15 +37,15 @@
|
|||
<noscript>Test not run - javascript required.</noscript>
|
||||
<div id="log"></div>
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
var styleElement;
|
||||
var styleSheet;
|
||||
var mediaList;
|
||||
|
||||
|
||||
// Setup
|
||||
function setup() {
|
||||
styleElement = document.getElementById("styleElement");
|
||||
|
||||
|
||||
if (styleElement) {
|
||||
// teardown
|
||||
document.getElementsByTagName("head")[0].removeChild(styleElement);
|
||||
|
@ -53,57 +53,58 @@
|
|||
styleSheet = undefined;
|
||||
mediaList = undefined;
|
||||
}
|
||||
|
||||
|
||||
styleElement = document.createElement("style");
|
||||
styleElement.id = "styleElement";
|
||||
styleElement.type = "text/css";
|
||||
styleElement.media = "all";
|
||||
document.getElementsByTagName("head")[0].appendChild(styleElement);
|
||||
document.getElementsByTagName("head")[0].appendChild(styleElement);
|
||||
styleSheet = styleElement.sheet;
|
||||
mediaList = styleSheet.media;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
test(function() {
|
||||
setup();
|
||||
|
||||
assert_equals(mediaList.mediaText, "all");
|
||||
|
||||
|
||||
assert_equals(mediaList.mediaText, "all");
|
||||
|
||||
}, "mediatest_medialist_serialize_element",
|
||||
{ help: ["http://www.w3.org/TR/cssom/#the-medialist-interface", "http://www.w3.org/TR/cssom/#serializing-media-queries"],
|
||||
assert: ["MediaList.mediaText equals the 'media' value of the initial 'style' element."] });
|
||||
|
||||
test(function() {
|
||||
test(function() {
|
||||
setup();
|
||||
|
||||
|
||||
mediaList.appendMedium('screen');
|
||||
assert_equals(mediaList.mediaText, "all, screen");
|
||||
|
||||
assert_equals(mediaList.mediaText, "all, screen");
|
||||
|
||||
}, "mediatest_medialist_serialize_comma",
|
||||
{ help: ["http://www.w3.org/TR/cssom/#the-medialist-interface", "http://www.w3.org/TR/cssom/#serializing-media-queries"],
|
||||
assert: ["To serialize a comma-separated list concatenate all items of the list in list order while separating them by \",\" (U+002C), followed by a space (U+0020)."] });
|
||||
|
||||
|
||||
test(function() {
|
||||
setup();
|
||||
|
||||
|
||||
mediaList.deleteMedium('all');
|
||||
assert_equals(mediaList.mediaText, "");
|
||||
|
||||
assert_equals(mediaList.mediaText, "");
|
||||
|
||||
}, "mediatest_medialist_serialize_empty",
|
||||
{ help: ["http://www.w3.org/TR/cssom/#the-medialist-interface", "http://www.w3.org/TR/cssom/#serializing-media-queries"],
|
||||
assert: ["If the media query list is empty return the empty string."] });
|
||||
|
||||
|
||||
test(function() {
|
||||
setup();
|
||||
|
||||
|
||||
mediaList.appendMedium('screen');
|
||||
mediaList.appendMedium('print');
|
||||
assert_equals(mediaList.mediaText, "all, print, screen");
|
||||
|
||||
assert_equals(mediaList.mediaText, "all, print, screen");
|
||||
|
||||
}, "mediatest_medialist_serialize_lexicographical",
|
||||
{ help: ["http://www.w3.org/TR/cssom/#the-medialist-interface", "http://www.w3.org/TR/cssom/#serializing-media-queries"],
|
||||
assert: ["Each media query in the list of media queries should be sorted in lexicographical order."] });
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
</body></html>
|
|
@ -23,15 +23,15 @@
|
|||
<noscript>Test not run - javascript required.</noscript>
|
||||
<div id="log"></div>
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
var styleElement;
|
||||
var styleSheet;
|
||||
var mediaList;
|
||||
|
||||
|
||||
// Setup - accepts media value for style element, e.g. <style media=???">
|
||||
function setupMedia(media) {
|
||||
styleElement = document.getElementById("styleElement");
|
||||
|
||||
|
||||
if (styleElement) {
|
||||
// teardown
|
||||
document.getElementsByTagName("head")[0].removeChild(styleElement);
|
||||
|
@ -39,33 +39,34 @@
|
|||
styleSheet = undefined;
|
||||
mediaList = undefined;
|
||||
}
|
||||
|
||||
|
||||
styleElement = document.createElement("style");
|
||||
styleElement.id = "styleElement";
|
||||
styleElement.type = "text/css";
|
||||
styleElement.media = media;
|
||||
document.getElementsByTagName("head")[0].appendChild(styleElement);
|
||||
document.getElementsByTagName("head")[0].appendChild(styleElement);
|
||||
styleSheet = styleElement.sheet;
|
||||
mediaList = styleSheet.media;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
test(function() {
|
||||
setupMedia('not screen and (min-WIDTH:5px) AND (max-width:40px )');
|
||||
|
||||
assert_equals(mediaList.mediaText, "not screen and (max-width: 40px) and (min-width: 5px)");
|
||||
|
||||
|
||||
assert_equals(mediaList.mediaText, "not screen and (max-width: 40px) and (min-width: 5px)");
|
||||
|
||||
}, "mediatest_mediaquery_serialize_1",
|
||||
{ assert: ["First explicit example input (first column) and output (second column) in specification."] });
|
||||
|
||||
test(function() {
|
||||
setupMedia('all and (color) and (color) ');
|
||||
|
||||
assert_equals(mediaList.mediaText, "(color)");
|
||||
assert_equals(mediaList.mediaText, "(color)");
|
||||
|
||||
}, "mediatest_mediaquery_serialize_2",
|
||||
{ assert: ["Second explicit example input (first column) and output (second column) in specification."] });
|
||||
|
||||
{ assert: ["Second explicit example input (first column) and output (second column) in specification."] });
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
</body></html>
|
|
@ -65,7 +65,7 @@
|
|||
assert_own_property(styleSheet, "cssRules");
|
||||
assert_inherits(styleSheet, "insertRule");
|
||||
assert_inherits(styleSheet, "deleteRule");
|
||||
|
||||
|
||||
assert_readonly(styleSheet, "ownerRule");
|
||||
assert_readonly(styleSheet, "cssRules");
|
||||
}, "CSSStyleSheet_properties",
|
||||
|
@ -113,7 +113,7 @@
|
|||
assert_equals(styleSheet.href, null);
|
||||
assert_regexp_match(linkSheet.href, /support\/b-green.css$/);
|
||||
assert_regexp_match(importSheet.href, /support\/a-green.css$/);
|
||||
|
||||
|
||||
assert_equals(styleSheet.parentStyleSheet, null);
|
||||
assert_equals(linkSheet.parentStyleSheet, null);
|
||||
assert_equals(importSheet.parentStyleSheet, styleSheet);
|
||||
|
@ -124,4 +124,5 @@
|
|||
{ assert: "StyleSheet initial property values are correct" });
|
||||
</script>
|
||||
|
||||
|
||||
</body></html>
|
|
@ -36,7 +36,7 @@
|
|||
assert: [ "Initial rule list is of size 1",
|
||||
"Can add a rule at first index" ]
|
||||
});
|
||||
|
||||
|
||||
test(function() {
|
||||
sheet.deleteRule(0);
|
||||
assert_equals(sheet.cssRules.length, 1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue