Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: LayoutTests/cssom/insertrule-namespace-mapping.html

Issue 1321943002: Support for CSSOM CSSNamespaceRule interface (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated as per review comments Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
OLDNEW
« no previous file with comments | « LayoutTests/css3/supports-cssom-expected.txt ('k') | LayoutTests/fast/css/css-namespace-rule.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698