OLD | NEW |
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 Loading... |
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 } |
OLD | NEW |