| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <meta charset=utf-8> | 2 <meta charset=utf-8> |
| 3 <title>Node.appendChild applied to CharacterData</title> | 3 <title>Node.appendChild applied to CharacterData</title> |
| 4 <link rel=help href="https://dom.spec.whatwg.org/#dom-node-appendchild"> | 4 <link rel=help href="https://dom.spec.whatwg.org/#dom-node-appendchild"> |
| 5 <link rel=help href="https://dom.spec.whatwg.org/#introduction-to-the-dom"> | 5 <link rel=help href="https://dom.spec.whatwg.org/#introduction-to-the-dom"> |
| 6 <script src="../../../../resources/testharness.js"></script> | 6 <script src="/resources/testharness.js"></script> |
| 7 <script src="../../../../resources/testharnessreport.js"></script> | 7 <script src="/resources/testharnessreport.js"></script> |
| 8 <div id="log"></div> | 8 <div id="log"></div> |
| 9 <script> | 9 <script> |
| 10 function create(type) { | 10 function create(type) { |
| 11 switch (type) { | 11 switch (type) { |
| 12 case "Text": return document.createTextNode("test"); break; | 12 case "Text": return document.createTextNode("test"); break; |
| 13 case "Comment": return document.createComment("test"); break; | 13 case "Comment": return document.createComment("test"); break; |
| 14 case "ProcessingInstruction": return document.createProcessingInstruction("t
arget", "test"); break; | 14 case "ProcessingInstruction": return document.createProcessingInstruction("t
arget", "test"); break; |
| 15 } | 15 } |
| 16 } | 16 } |
| 17 | 17 |
| 18 function testNode(type1, type2) { | 18 function testNode(type1, type2) { |
| 19 test(function() { | 19 test(function() { |
| 20 var node1 = create(type1); | 20 var node1 = create(type1); |
| 21 var node2 = create(type2); | 21 var node2 = create(type2); |
| 22 assert_throws("HierarchyRequestError", function () { | 22 assert_throws("HierarchyRequestError", function () { |
| 23 node1.appendChild(node2); | 23 node1.appendChild(node2); |
| 24 }, "CharacterData type " + type1 + " must not have children"); | 24 }, "CharacterData type " + type1 + " must not have children"); |
| 25 }, type1 + ".appendChild(" + type2 + ")"); | 25 }, type1 + ".appendChild(" + type2 + ")"); |
| 26 } | 26 } |
| 27 | 27 |
| 28 var types = ["Text", "Comment", "ProcessingInstruction"]; | 28 var types = ["Text", "Comment", "ProcessingInstruction"]; |
| 29 types.forEach(function(type1) { | 29 types.forEach(function(type1) { |
| 30 types.forEach(function(type2) { | 30 types.forEach(function(type2) { |
| 31 testNode(type1, type2); | 31 testNode(type1, type2); |
| 32 }); | 32 }); |
| 33 }); | 33 }); |
| 34 </script> | 34 </script> |
| OLD | NEW |