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

Side by Side Diff: third_party/WebKit/LayoutTests/shadow-dom/resources/shadow-dom.js

Issue 2060793002: Rewrite tests for slots (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@events-related
Patch Set: fixed Created 4 years, 6 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/shadow-dom/slots.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 function removeWhiteSpaceOnlyTextNodes(node) 1 function removeWhiteSpaceOnlyTextNodes(node)
2 { 2 {
3 for (var i = 0; i < node.childNodes.length; i++) { 3 for (var i = 0; i < node.childNodes.length; i++) {
4 var child = node.childNodes[i]; 4 var child = node.childNodes[i];
5 if (child.nodeType === Node.TEXT_NODE && child.nodeValue.trim().length = = 0) { 5 if (child.nodeType === Node.TEXT_NODE && child.nodeValue.trim().length == 0) {
6 node.removeChild(child); 6 node.removeChild(child);
7 i--; 7 i--;
8 } else if (child.nodeType === Node.ELEMENT_NODE || child.nodeType === No de.DOCUMENT_FRAGMENT_NODE) { 8 } else if (child.nodeType === Node.ELEMENT_NODE || child.nodeType === Node.D OCUMENT_FRAGMENT_NODE) {
9 removeWhiteSpaceOnlyTextNodes(child); 9 removeWhiteSpaceOnlyTextNodes(child);
10 }
11 } 10 }
12 if (node.shadowRoot) { 11 }
13 removeWhiteSpaceOnlyTextNodes(node.shadowRoot); 12 if (node.shadowRoot) {
14 } 13 removeWhiteSpaceOnlyTextNodes(node.shadowRoot);
14 }
15 } 15 }
16 16
17 function convertTemplatesToShadowRootsWithin(node) { 17 function convertTemplatesToShadowRootsWithin(node) {
18 var nodes = node.querySelectorAll("template"); 18 var nodes = node.querySelectorAll("template");
19 for (var i = 0; i < nodes.length; ++i) { 19 for (var i = 0; i < nodes.length; ++i) {
20 var template = nodes[i]; 20 var template = nodes[i];
21 var mode = template.getAttribute("data-mode"); 21 var mode = template.getAttribute("data-mode");
22 var parent = template.parentNode; 22 var parent = template.parentNode;
23 parent.removeChild(template); 23 parent.removeChild(template);
24 var shadowRoot; 24 var shadowRoot;
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 // This function assumes that testharness.js is available. 184 // This function assumes that testharness.js is available.
185 function assert_event_path_equals(actual, expected) { 185 function assert_event_path_equals(actual, expected) {
186 assert_equals(actual.length, expected.length); 186 assert_equals(actual.length, expected.length);
187 for (let i = 0; i < actual.length; ++i) { 187 for (let i = 0; i < actual.length; ++i) {
188 assert_equals(actual[i][0], expected[i][0], 'currentTarget at ' + i + ' shou ld be same'); 188 assert_equals(actual[i][0], expected[i][0], 'currentTarget at ' + i + ' shou ld be same');
189 assert_equals(actual[i][1], expected[i][1], 'target at ' + i + ' should be s ame'); 189 assert_equals(actual[i][1], expected[i][1], 'target at ' + i + ' should be s ame');
190 assert_equals(actual[i][2], expected[i][2], 'relatedTarget at ' + i + ' shou ld be same'); 190 assert_equals(actual[i][2], expected[i][2], 'relatedTarget at ' + i + ' shou ld be same');
191 assert_array_equals(actual[i][3], expected[i][3], 'composedPath at ' + i + ' should be same'); 191 assert_array_equals(actual[i][3], expected[i][3], 'composedPath at ' + i + ' should be same');
192 } 192 }
193 } 193 }
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/shadow-dom/slots.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698