OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <script src="../../../resources/testharness.js"></script> | |
3 <script src="../../../resources/testharnessreport.js"></script> | |
4 <script> | |
5 | |
6 function test_append_on_Document() { | |
7 | |
8 var node = document.implementation.createDocument(null, null); | |
9 test(function() { | |
10 var parent = node.cloneNode(); | |
11 parent.append(); | |
12 assert_array_equals(parent.childNodes, []); | |
13 }, 'Document.append() without any argument, on a Document having no child.')
; | |
14 | |
15 test(function() { | |
16 var parent = node.cloneNode(); | |
17 var x = document.createElement('x'); | |
18 parent.append(x); | |
19 assert_array_equals(parent.childNodes, [x]); | |
20 }, 'Document.append() with only one element as an argument, on a Document ha
ving no child.'); | |
21 | |
22 test(function() { | |
23 var parent = node.cloneNode(); | |
24 var x = document.createElement('x'); | |
25 var y = document.createElement('y'); | |
26 parent.appendChild(x); | |
27 assert_throws('HierarchyRequestError', function() { parent.append(y); })
; | |
28 assert_array_equals(parent.childNodes, [x]); | |
29 }, 'Document.append() with only one element as an argument, on a Document ha
ving one child.'); | |
30 | |
31 test(function() { | |
32 var parent = node.cloneNode(); | |
33 assert_throws('HierarchyRequestError', function() { parent.append('text'
); }); | |
34 assert_array_equals(parent.childNodes, []); | |
35 }, 'Document.append() with text as an argument, on a Document having no chil
d.'); | |
36 | |
37 test(function() { | |
38 var parent = node.cloneNode(); | |
39 var x = document.createElement('x'); | |
40 var y = document.createElement('y'); | |
41 assert_throws('HierarchyRequestError', function() { parent.append(x, y);
}); | |
42 assert_array_equals(parent.childNodes, []); | |
43 }, 'Document.append() with two elements as the argument, on a Document havin
g no child.'); | |
44 | |
45 } | |
46 | |
47 test_append_on_Document(); | |
48 | |
49 </script> | |
50 </html> | |
OLD | NEW |