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_prepend_on_Document() { | |
7 | |
8 var node = document.implementation.createDocument(null, null); | |
9 test(function() { | |
10 var parent = node.cloneNode(); | |
11 parent.prepend(); | |
12 assert_array_equals(parent.childNodes, []); | |
13 }, 'Document.prepend() 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.prepend(x); | |
19 assert_array_equals(parent.childNodes, [x]); | |
20 }, 'Document.prepend() with only one element as an argument, on a Document h
aving 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.prepend(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.prepend('text
'); }); | |
34 assert_array_equals(parent.childNodes, []); | |
35 }, 'Document.prepend() with text as an argument, on a Document having no chi
ld.'); | |
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.prepend(x, y)
; }); | |
42 assert_array_equals(parent.childNodes, []); | |
43 }, 'Document.prepend() with two elements as the argument, on a Document havi
ng no child.'); | |
44 | |
45 } | |
46 | |
47 test_prepend_on_Document(); | |
48 | |
49 </script> | |
50 </html> | |
OLD | NEW |