OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../resources/testharness.js"></script> | 2 <script src="../resources/testharness.js"></script> |
3 <script src="../resources/testharnessreport.js"></script> | 3 <script src="../resources/testharnessreport.js"></script> |
4 <style id='style'> | 4 <style id='style'> |
5 @namespace tns url(test-namespace); | 5 @namespace tns url(test-namespace); |
6 @media all {} | 6 @media all {} |
7 </style> | 7 </style> |
8 <body></body> | 8 <body></body> |
9 <script> | 9 <script> |
10 function assertColorGreen(id) { | 10 function assertColorGreen(id) { |
11 var element = document.createElementNS('test-namespace', 'tns:div'); | 11 var element = document.createElementNS('test-namespace', 'tns:div'); |
12 element.id = id; | 12 element.id = id; |
13 element.setAttributeNS('test-namespace', 'tns:green', true); | 13 element.setAttributeNS('test-namespace', 'tns:green', true); |
14 document.body.appendChild(element); | 14 document.body.appendChild(element); |
15 assert_equals(getComputedStyle(element).color, 'rgb(0, 128, 0)'); | 15 assert_equals(getComputedStyle(element).color, 'rgb(0, 128, 0)'); |
16 } | 16 } |
17 | 17 |
18 test(function() { | 18 test(function() { |
19 style.sheet.insertRule('tns|#testInsertRule[tns|green] { color: green; }', sty
le.sheet.length); | 19 style.sheet.insertRule('tns|#testInsertRule[tns|green] { color: green; }', sty
le.sheet.cssRules.length); |
20 assertColorGreen('testInsertRule'); | 20 assertColorGreen('testInsertRule'); |
21 }, 'Selectors added to CSSStyleSheets via insertRule() should use the @namespace
mapping'); | 21 }, 'Selectors added to CSSStyleSheets via insertRule() should use the @namespace
mapping'); |
22 | 22 |
23 test(function() { | 23 test(function() { |
24 var mediaRule = style.sheet.rules[1]; | 24 var mediaRule = style.sheet.rules[1]; |
25 console.assert(mediaRule instanceof CSSMediaRule); // CSSMediaRule inherits fr
om the CSSGroupingRule interface. | 25 console.assert(mediaRule instanceof CSSMediaRule); // CSSMediaRule inherits fr
om the CSSGroupingRule interface. |
26 mediaRule.insertRule('tns|#testMediaInsertRule[tns|green] { color: green; }',
style.sheet.length); | 26 mediaRule.insertRule('tns|#testMediaInsertRule[tns|green] { color: green; }',
style.sheet.length); |
27 assertColorGreen('testMediaInsertRule'); | 27 assertColorGreen('testMediaInsertRule'); |
28 }, 'Selectors added to CSSGroupingRules via insertRule() should use the @namespa
ce mapping'); | 28 }, 'Selectors added to CSSGroupingRules via insertRule() should use the @namespa
ce mapping'); |
29 </script> | 29 </script> |
OLD | NEW |