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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/css/css-set-selector-text.html

Issue 1616423003: Fix selector namespace prefix resolution. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed review issues Created 4 years, 11 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/css/css-set-selector-text-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <html> 1 <html>
2 <head id="head"> 2 <head id="head">
3 <script src="../../resources/js-test.js"></script> 3 <script src="../../resources/js-test.js"></script>
4 </head> 4 </head>
5 <body> 5 <body>
6 <script> 6 <script>
7 7
8 description("This tests setting and re-serialization of some CSS selectors."); 8 description("This tests setting and re-serialization of some CSS selectors.");
9 9
10 var bogusSelector = "_foo"; 10 var bogusSelector = "_foo";
11 11
12 function setThenReadSelectorText(selector) 12 function setThenReadSelectorText(selector)
13 { 13 {
14 var styleElement = document.getElementById("style"); 14 var styleElement = document.getElementById("style");
15 var head = document.getElementById("head"); 15 var head = document.getElementById("head");
16 if (styleElement) 16 if (styleElement)
17 head.removeChild(styleElement); 17 head.removeChild(styleElement);
18 18
19 styleElement = document.createElement("style"); 19 styleElement = document.createElement("style");
20 styleElement.id = "style"; 20 styleElement.id = "style";
21 var head = document.getElementById("head"); 21 var head = document.getElementById("head");
22 head.appendChild(styleElement); 22 head.appendChild(styleElement);
23 23
24 // First, create a rule with a bogus selector. 24 // First, create a rule with a bogus selector.
25 styleElement.appendChild(document.createTextNode(bogusSelector + " { }")); 25 styleElement.appendChild(document.createTextNode("@namespace n url(test); " + bogusSelector + " { }"));
26 // Now, set the desired selector text. 26 // Now, set the desired selector text.
27 styleElement.sheet.cssRules[0].selectorText = selector; 27 styleElement.sheet.cssRules[1].selectorText = selector;
28 return styleElement.sheet.cssRules[0].selectorText; 28 return styleElement.sheet.cssRules[1].selectorText;
29 } 29 }
30 30
31 function testSelectorRoundTrip(selector, expectFailure) 31 function testSelectorRoundTrip(selector, expectFailure)
32 { 32 {
33 shouldBe("setThenReadSelectorText('" + selector + "')", "'" + (expectFailure ? bogusSelector : selector) + "'"); 33 shouldBe("setThenReadSelectorText('" + selector + "')", "'" + (expectFailure ? bogusSelector : selector) + "'");
34 } 34 }
35 35
36 testSelectorRoundTrip('', true); 36 testSelectorRoundTrip('', true);
37 testSelectorRoundTrip('123', true); 37 testSelectorRoundTrip('123', true);
38 testSelectorRoundTrip('-', true); 38 testSelectorRoundTrip('-', true);
(...skipping 20 matching lines...) Expand all
59 testSelectorRoundTrip('[a*="b"]'); 59 testSelectorRoundTrip('[a*="b"]');
60 60
61 debug(''); 61 debug('');
62 62
63 testSelectorRoundTrip('*|a'); 63 testSelectorRoundTrip('*|a');
64 testSelectorRoundTrip('n|a'); 64 testSelectorRoundTrip('n|a');
65 testSelectorRoundTrip('*|*'); 65 testSelectorRoundTrip('*|*');
66 testSelectorRoundTrip('n|*'); 66 testSelectorRoundTrip('n|*');
67 testSelectorRoundTrip('[*|a]'); 67 testSelectorRoundTrip('[*|a]');
68 testSelectorRoundTrip('[n|a]'); 68 testSelectorRoundTrip('[n|a]');
69 testSelectorRoundTrip('unresolved|a', true);
70 testSelectorRoundTrip('unresolved|*', true);
71 testSelectorRoundTrip('[unresolved|a]', true);
69 72
70 debug(''); 73 debug('');
71 74
72 testSelectorRoundTrip('a:active'); 75 testSelectorRoundTrip('a:active');
73 testSelectorRoundTrip('a b'); 76 testSelectorRoundTrip('a b');
74 testSelectorRoundTrip('a + b'); 77 testSelectorRoundTrip('a + b');
75 testSelectorRoundTrip('a ~ b'); 78 testSelectorRoundTrip('a ~ b');
76 testSelectorRoundTrip('a > b'); 79 testSelectorRoundTrip('a > b');
77 80
78 debug(''); 81 debug('');
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 shouldBe("setThenReadSelectorText(':before')", "'::before'"); 177 shouldBe("setThenReadSelectorText(':before')", "'::before'");
175 shouldBe("setThenReadSelectorText(':first-letter')", "'::first-letter'"); 178 shouldBe("setThenReadSelectorText(':first-letter')", "'::first-letter'");
176 shouldBe("setThenReadSelectorText(':first-line')", "'::first-line'"); 179 shouldBe("setThenReadSelectorText(':first-line')", "'::first-line'");
177 shouldBe("setThenReadSelectorText(':-webkit-any( a.class1 , #id,[att r] )')","':-webkit-any(a.class1,#id,[attr])'"); 180 shouldBe("setThenReadSelectorText(':-webkit-any( a.class1 , #id,[att r] )')","':-webkit-any(a.class1,#id,[attr])'");
178 181
179 debug(''); 182 debug('');
180 183
181 </script> 184 </script>
182 </body> 185 </body>
183 </html> 186 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/css/css-set-selector-text-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698