2 <script src=
"../resources/testharness.js"></script>
3 <script src=
"../resources/testharnessreport.js"></script>
5 @namespace tns url(test-namespace);
10 function assertColorGreen(id
) {
11 var element
= document
.createElementNS('test-namespace', 'tns:div');
13 element
.setAttributeNS('test-namespace', 'tns:green', true);
14 document
.body
.appendChild(element
);
15 assert_equals(getComputedStyle(element
).color
, 'rgb(0, 128, 0)');
19 style
.sheet
.insertRule('tns|#testInsertRule[tns|green] { color: green; }', style
.sheet
.cssRules
.length
);
20 assertColorGreen('testInsertRule');
21 }, 'Selectors added to CSSStyleSheets via insertRule() should use the @namespace mapping');
24 var mediaRule
= style
.sheet
.rules
[1];
25 console
.assert(mediaRule
instanceof CSSMediaRule
); // CSSMediaRule inherits from the CSSGroupingRule interface.
26 mediaRule
.insertRule('tns|#testMediaInsertRule[tns|green] { color: green; }', style
.sheet
.length
);
27 assertColorGreen('testMediaInsertRule');
28 }, 'Selectors added to CSSGroupingRules via insertRule() should use the @namespace mapping');