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