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 node = document.createElement('div'); | 7 var node = document.createElement('div'); |
8 assert_true('append' in node); | 8 assert_true('append' in node); |
9 var append = 'mine'; | 9 var append = 'mine'; |
10 var getAttribute = 'mine'; | 10 var getAttribute = 'mine'; |
11 with (node) { | 11 with (node) { |
12 assert_true(append === 'mine'); | 12 assert_true(append === '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(node)[Symbol.unscopables]; | 16 var unscopables = Object.getPrototypeOf(node)[Symbol.unscopables]; |
17 assert_true(unscopables.append); | 17 assert_true(unscopables.append); |
18 }, 'ChildNode.append() unscopeable'); | 18 }, 'ChildNode.append() unscopable'); |
19 | 19 |
20 function test_append(node, nodeName) { | 20 function test_append(node, nodeName) { |
21 | 21 |
22 test(function() { | 22 test(function() { |
23 var parent = node.cloneNode(); | 23 var parent = node.cloneNode(); |
24 parent.append(); | 24 parent.append(); |
25 assert_array_equals(parent.childNodes, []); | 25 assert_array_equals(parent.childNodes, []); |
26 }, nodeName + '.append() without any argument, on a parent having no child.'
); | 26 }, nodeName + '.append() without any argument, on a parent having no child.'
); |
27 | 27 |
28 test(function() { | 28 test(function() { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 var doc2 = document.implementation.createDocument("http://www.w3.org/199
9/xhtml", "html"); | 85 var doc2 = document.implementation.createDocument("http://www.w3.org/199
9/xhtml", "html"); |
86 assert_throws('HierarchyRequestError', () => { parent.append(doc2, "foo"
) }); | 86 assert_throws('HierarchyRequestError', () => { parent.append(doc2, "foo"
) }); |
87 assert_equals(parent.firstChild, null); | 87 assert_equals(parent.firstChild, null); |
88 }, nodeName + '.append() with a Document as an argument should throw.'); | 88 }, nodeName + '.append() with a Document as an argument should throw.'); |
89 } | 89 } |
90 | 90 |
91 test_append(document.createElement('div'), 'Element'); | 91 test_append(document.createElement('div'), 'Element'); |
92 test_append(document.createDocumentFragment(), 'DocumentFrgment'); | 92 test_append(document.createDocumentFragment(), 'DocumentFrgment'); |
93 </script> | 93 </script> |
94 </html> | 94 </html> |
OLD | NEW |