OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="../../../resources/testharness.js"></script> |
| 3 <script src="../../../resources/testharnessreport.js"></script> |
| 4 <script> |
| 5 |
| 6 test(function() { |
| 7 var node = document.createElement('node'); |
| 8 assert_true('append' in node); |
| 9 assert_equals(typeof node.append, 'function'); |
| 10 assert_equals(node.append.length, 0); |
| 11 }, "Element should support append()"); |
| 12 |
| 13 test(function() { |
| 14 var parent = document.createElement('div'); |
| 15 var test = document.createElement('test'); |
| 16 parent.appendChild(test); |
| 17 var x = document.createElement('x'); |
| 18 var z = document.createElement('z'); |
| 19 |
| 20 parent.append(x, 'y', z); |
| 21 |
| 22 assert_equals(parent.childNodes.length, 4, 'parent should have 4 children'); |
| 23 assert_equals(parent.firstChild, test, 'parent\'s first child should be test')
; |
| 24 assert_equals(parent.childNodes[1], x, 'parent\'s second child should be x'); |
| 25 assert_equals(parent.childNodes[2].data, 'y', 'parent\'s third child should be
"y"'); |
| 26 assert_equals(parent.lastChild, z, 'parent\'s last child should be z'); |
| 27 }, "append() should work for Element"); |
| 28 </script> |
| 29 </html> |
OLD | NEW |