gecko-dev/testing/web-platform/tests/dom/nodes/CharacterData-appendChild.html
James Graham 05dac13cde Bug 1260772 - Update web-platform-tests to revision e9b6636c067fc08b9eb393a1c0ff380a77ae1786, a=testonly
MozReview-Commit-ID: 3cs3y3zPVja


--HG--
rename : testing/web-platform/tests/dom/nodes/Node-contains.xml => testing/web-platform/tests/dom/nodes/Node-contains-xml.xml
rename : testing/web-platform/tests/dom/nodes/Node-isEqualNode.xhtml => testing/web-platform/tests/dom/nodes/Node-isEqualNode-xhtml.xhtml
rename : testing/web-platform/tests/html/rendering/non-replaced-elements/lists/li-type-supported.xhtml => testing/web-platform/tests/html/rendering/non-replaced-elements/lists/li-type-supported-xhtml.xhtml
rename : testing/web-platform/tests/html/rendering/non-replaced-elements/lists/ol-type-supported.xhtml => testing/web-platform/tests/html/rendering/non-replaced-elements/lists/ol-type-supported-xhtml.xhtml
rename : testing/web-platform/tests/html/rendering/non-replaced-elements/lists/ul-type-supported.xhtml => testing/web-platform/tests/html/rendering/non-replaced-elements/lists/ul-type-supported-xhtml.xhtml
rename : testing/web-platform/tests/html/semantics/embedded-content/the-canvas-element/2d.scaled-manual.png => testing/web-platform/tests/html/semantics/embedded-content/the-canvas-element/2d.scaled.png
2016-04-01 15:58:08 +01:00

34 lines
1.1 KiB
HTML

<!DOCTYPE html>
<meta charset=utf-8>
<title>Node.appendChild applied to CharacterData</title>
<link rel=help href="https://dom.spec.whatwg.org/#dom-node-appendchild">
<link rel=help href="https://dom.spec.whatwg.org/#introduction-to-the-dom">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
function create(type) {
switch (type) {
case "Text": return document.createTextNode("test"); break;
case "Comment": return document.createComment("test"); break;
case "ProcessingInstruction": return document.createProcessingInstruction("target", "test"); break;
}
}
function testNode(type1, type2) {
test(function() {
var node1 = create(type1);
var node2 = create(type2);
assert_throws("HierarchyRequestError", function () {
node1.appendChild(node2);
}, "CharacterData type " + type1 + " must not have children");
}, type1 + ".appendChild(" + type2 + ")");
}
var types = ["Text", "Comment", "ProcessingInstruction"];
types.forEach(function(type1) {
types.forEach(function(type2) {
testNode(type1, type2);
});
});
</script>