OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../../../resources/testharness.js"></script> | 2 <script src="../../../resources/testharness.js"></script> |
3 <script src="../../../resources/testharnessreport.js"></script> | 3 <script src="../../../resources/testharnessreport.js"></script> |
4 <script> | 4 <script> |
5 | 5 |
6 test(function () { | 6 test(function () { |
7 var child = document.createElement('p'); | 7 var child = document.createElement('p'); |
8 assert_true('replaceWith' in child); | 8 assert_true('replaceWith' in child); |
9 var replaceWith = 'mine'; | 9 var replaceWith = 'mine'; |
10 var getAttribute = 'mine'; | 10 var getAttribute = 'mine'; |
11 with (child) { | 11 with (child) { |
12 assert_true(replaceWith === 'mine'); | 12 assert_true(replaceWith === 'mine'); |
13 assert_false(getAttribute === 'mine'); | 13 assert_false(getAttribute === 'mine'); |
14 } | 14 } |
15 assert_true('Symbol' in window); | 15 assert_true('Symbol' in window); |
16 var unscopables = Object.getPrototypeOf(child)[Symbol.unscopables]; | 16 var unscopables = Object.getPrototypeOf(child)[Symbol.unscopables]; |
17 assert_true(unscopables.replaceWith); | 17 assert_true(unscopables.replaceWith); |
18 }, 'ChildNode.replaceWith() unscopeable'); | 18 }, 'ChildNode.replaceWith() unscopable'); |
19 | 19 |
20 function test_replaceWith(nodeName) { | 20 function test_replaceWith(nodeName) { |
21 var child; | 21 var child; |
22 var innerHTML; | 22 var innerHTML; |
23 if (nodeName == 'Comment') { | 23 if (nodeName == 'Comment') { |
24 child = document.createComment('test'); | 24 child = document.createComment('test'); |
25 innerHTML = '<!--test-->'; | 25 innerHTML = '<!--test-->'; |
26 } else if (nodeName == 'Element') { | 26 } else if (nodeName == 'Element') { |
27 child = document.createElement('test'); | 27 child = document.createElement('test'); |
28 innerHTML = '<test></test>'; | 28 innerHTML = '<test></test>'; |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 assert_equals(parent.firstChild, child); | 133 assert_equals(parent.firstChild, child); |
134 }, nodeName + '.replaceWith() with a Document as an argument should throw.')
; | 134 }, nodeName + '.replaceWith() with a Document as an argument should throw.')
; |
135 } | 135 } |
136 | 136 |
137 test_replaceWith('Comment'); | 137 test_replaceWith('Comment'); |
138 test_replaceWith('Element'); | 138 test_replaceWith('Element'); |
139 test_replaceWith('Text'); | 139 test_replaceWith('Text'); |
140 | 140 |
141 </script> | 141 </script> |
142 </html> | 142 </html> |
OLD | NEW |