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

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

Issue 2030513002: Remove Event.relatedTargetScoped and update event path calculation for relatedTarget (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed 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
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 === No de.DOCUMENT_FRAGMENT_NODE) {
9 removeWhiteSpaceOnlyTextNodes(child); 9 removeWhiteSpaceOnlyTextNodes(child);
10 } 10 }
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 event.relatedTarget ? labelFor(event.relatedTarget) : null, 123 event.relatedTarget ? labelFor(event.relatedTarget) : null,
124 event.composedPath().map((n) => { 124 event.composedPath().map((n) => {
125 return labelFor(n); 125 return labelFor(n);
126 })]); 126 })]);
127 }); 127 });
128 } 128 }
129 } 129 }
130 target.dispatchEvent(event); 130 target.dispatchEvent(event);
131 return log; 131 return log;
132 } 132 }
133
134 // This function assumes that testharness.js is available.
135 function assert_event_path_equals(actual, expected) {
136 assert_equals(actual.length, expected.length);
137 for (let i = 0; i < actual.length; ++i) {
138 assert_equals(actual[i][0], expected[i][0], 'currentTarget at ' + i + ' shou ld be same');
139 assert_equals(actual[i][1], expected[i][1], 'relatedTarget at ' + i + ' shou ld be same');
140 assert_array_equals(actual[i][2], expected[i][2], 'composedPath at ' + i + ' should be same');
141 }
142 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698