test(function() {
assert_equals(styleSheet.addRule("@media all", "#foo { color: red }"), -1);
assert_equals(styleSheet.cssRules.length, 2, "CSSStyleSheet cssRules attribute after addRule function");
assert_true(styleSheet.cssRules[1] instanceof CSSMediaRule, "CSSStyleSheet addRule does some silly string concatenation");
}, 'addRule with @media rule');
test(function() {
styleSheet.removeRule(1);
assert_equals(styleSheet.cssRules.length, 1, "CSSStyleSheet cssRules attribute after removeRule function with index");
assert_equals(styleSheet.cssRules[0].cssText, "#foo { height: 100px; }", "CSSStyleSheet cssRules attribute after deleteRule function with index");
}, 'removeRule(1)');
test(function() {
assert_equals(styleSheet.addRule("#foo", "color: red"), -1);
assert_equals(styleSheet.cssRules.length, 2, "CSSStyleSheet cssRules attribute after addRule function with simple selector");
assert_equals(styleSheet.cssRules[1].cssText, "#foo { color: red; }", "CSSStyleSheet cssRules attribute after addRule function without index appends to the end");
assert_equals(styleSheet.addRule("#foo", "color: blue", 0), -1);
assert_equals(styleSheet.cssRules.length, 3, "CSSStyleSheet cssRules attribute after addRule function with simple selector with index");
assert_equals(styleSheet.cssRules[0].cssText, "#foo { color: blue; }", "addRule function with index performs an insertion");
}, 'addRule with #foo selectors');
test(function() {
assert_equals(styleSheet.addRule(), -1);
assert_equals(styleSheet.cssRules.length, 4, "CSSStyleSheet cssRules attribute after addRule function without arguments");
assert_equals(styleSheet.cssRules[3].cssText, "undefined { }", "addRule arguments default to undefined");
}, 'addRule with no argument adds "undefined" selector');
test(function() {
assert_throws_dom("IndexSizeError", function() {
styleSheet.addRule("#foo", "color: red", styleSheet.cssRules.length + 1);
});
}, 'addRule with index greater than length throws');
test(function() {
assert_equals(styleSheet.cssRules, styleSheet.rules);
}, "cssRules and rules are the same object");
test(function() {
assert_equals(styleSheet.cssRules, styleSheet.cssRules);
}, "cssRules returns the same object twice");
test(function() {
assert_equals(styleSheet.rules, styleSheet.rules);
}, "rules returns the same object twice");
</script>
</head>
</html>
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.17Bemerkung:
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.