Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / cssom / insertrule-namespace-mapping.html
blob0264bc7a2f5defb31440fd3d8d3432fa5c504efb
1 <!DOCTYPE html>
2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script>
4 <style id='style'>
5 @namespace tns url(test-namespace);
6 @media all {}
7 </style>
8 <body></body>
9 <script>
10 function assertColorGreen(id) {
11 var element = document.createElementNS('test-namespace', 'tns:div');
12 element.id = id;
13 element.setAttributeNS('test-namespace', 'tns:green', true);
14 document.body.appendChild(element);
15 assert_equals(getComputedStyle(element).color, 'rgb(0, 128, 0)');
18 test(function() {
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');
23 test(function() {
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');
29 </script>