Summary

Harness status: OK

Found 29 tests

Details

ResultTest NameMessage
PassShould check the 'parent' type before checking whether 'child' is a child of 'parent'
Asserts run
Pass
assert_throws_dom("HierarchyRequestError", function "function() {       insertFunc.call(parent, node, child);     }")
    at  /dom/nodes/pre-insertion-validation-notfound.js:34:5
Pass
assert_throws_dom("HierarchyRequestError", function "function() {       insertFunc.call(parent, node, child);     }")
    at  /dom/nodes/pre-insertion-validation-notfound.js:34:5
Pass
assert_throws_dom("HierarchyRequestError", function "function() {       insertFunc.call(parent, node, child);     }")
    at  /dom/nodes/pre-insertion-validation-notfound.js:34:5
Pass
assert_throws_dom("HierarchyRequestError", function "function() {       insertFunc.call(parent, node, child);     }")
    at  /dom/nodes/pre-insertion-validation-notfound.js:34:5
Pass
assert_throws_dom("HierarchyRequestError", function "function() {       insertFunc.call(parent, node, child);     }")
    at  /dom/nodes/pre-insertion-validation-notfound.js:34:5
PassShould check that 'node' is not an ancestor of 'parent' before checking whether 'child' is a child of 'parent'
Asserts run
Pass
assert_throws_dom("HierarchyRequestError", function "function() {     insertFunc.call(parent, node, child);   }")
    at Test.<anonymous> ( /dom/nodes/pre-insertion-validation-notfound.js:47:3)
PassShould check whether 'child' is a child of 'parent' before checking whether 'node' is of a type that can have a parent.
Asserts run
Pass
assert_throws_dom("NotFoundError", function "function() {       insertFunc.call(parent, node, child);     }")
    at  /dom/nodes/pre-insertion-validation-notfound.js:59:5
PassShould check whether 'child' is a child of 'parent' before checking whether 'node' is of a type that can have a parent of the type that 'parent' is.
Asserts run
Pass
assert_throws_dom("NotFoundError", function "function() {     insertFunc.call(parent, node, child);   }")
    at Test.<anonymous> ( /dom/nodes/pre-insertion-validation-notfound.js:72:3)
Pass
assert_throws_dom("NotFoundError", function "function() {       insertFunc.call(parent, node, child);     }")
    at  /dom/nodes/pre-insertion-validation-notfound.js:78:5
Pass
assert_throws_dom("NotFoundError", function "function() {       insertFunc.call(parent, node, child);     }")
    at  /dom/nodes/pre-insertion-validation-notfound.js:78:5
PassShould check whether 'child' is a child of 'parent' before checking whether 'node' can be inserted into the document given the kids the document has right now.
Asserts run
Pass
assert_throws_dom("NotFoundError", function "function() {     insertFunc.call(parent, node, child);   }")
    at Test.<anonymous> ( /dom/nodes/pre-insertion-validation-notfound.js:92:3)
Pass
assert_throws_dom("NotFoundError", function "function() {     insertFunc.call(parent, node, child);   }")
    at Test.<anonymous> ( /dom/nodes/pre-insertion-validation-notfound.js:98:3)
Pass
assert_throws_dom("NotFoundError", function "function() {     insertFunc.call(parent, node, child);   }")
    at Test.<anonymous> ( /dom/nodes/pre-insertion-validation-notfound.js:105:3)
PassPassing null to replaceChild should throw a TypeError.
Asserts run
Pass
assert_throws_js(function "function TypeError() { [native code] }", function "function() {     a.replaceChild(null, null);   }")
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:18:3)
Pass
assert_throws_js(function "function TypeError() { [native code] }", function "function() {     a.replaceChild(b, null);   }")
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:23:3)
Pass
assert_throws_js(function "function TypeError() { [native code] }", function "function() {     a.replaceChild(null, b);   }")
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:26:3)
PassIf child's parent is not the context node, a NotFoundError exception should be thrown
Asserts run
Pass
assert_throws_dom("NotFoundError", function "function() {     a.replaceChild(b, c);   }")
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:36:3)
Pass
assert_throws_dom("NotFoundError", function "function() {     a.replaceChild(b, c);   }")
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:42:3)
Pass
assert_throws_dom("NotFoundError", function "function() {     a.replaceChild(b, a);   }")
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:45:3)
PassIf the context node is not a node that can contain children, a HierarchyRequestError exception should be thrown
Asserts run
Pass
assert_throws_dom("HierarchyRequestError", function "function() {       node.replaceChild(a, b);     }")
    at  /dom/nodes/Node-replaceChild.html:57:5
Pass
assert_throws_dom("HierarchyRequestError", function "function() {       node.replaceChild(a, b);     }")
    at  /dom/nodes/Node-replaceChild.html:57:5
Pass
assert_throws_dom("HierarchyRequestError", function "function() {       node.replaceChild(a, b);     }")
    at  /dom/nodes/Node-replaceChild.html:57:5
Pass
assert_throws_dom("HierarchyRequestError", function "function() {       node.replaceChild(a, b);     }")
    at  /dom/nodes/Node-replaceChild.html:57:5
Pass
assert_throws_dom("HierarchyRequestError", function "function() {       node.replaceChild(a, b);     }")
    at  /dom/nodes/Node-replaceChild.html:57:5
PassIf node is an inclusive ancestor of the context node, a HierarchyRequestError should be thrown.
Asserts run
Pass
assert_throws_dom("HierarchyRequestError", function "function() {     a.replaceChild(a, a);   }")
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:68:3)
Pass
assert_throws_dom("HierarchyRequestError", function "function() {     a.replaceChild(a, b);   }")
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:73:3)
Pass
assert_throws_dom("HierarchyRequestError", function "function() {     a.replaceChild(c, b);   }")
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:79:3)
PassIf the context node is a document, inserting a document or text node should throw a HierarchyRequestError.
Asserts run
Pass
assert_throws_dom("HierarchyRequestError", function "function() {     doc.replaceChild(doc2, doc.documentElement);   }")
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:88:3)
Pass
assert_throws_dom("HierarchyRequestError", function "function() {     doc.replaceChild(doc.createTextNode("text"), doc.documentElement);   }")
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:92:3)
PassIf the context node is a document, inserting a DocumentFragment that contains a text node or too many elements should throw a HierarchyRequestError.
Asserts run
Pass
assert_throws_dom("HierarchyRequestError", function "function() {     doc.replaceChild(df, doc.documentElement);   }")
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:104:3)
Pass
assert_throws_dom("HierarchyRequestError", function "function() {     doc.replaceChild(df, doc.documentElement);   }")
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:110:3)
Pass
assert_throws_dom("HierarchyRequestError", function "function() {     doc.replaceChild(df, doc.documentElement);   }")
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:117:3)
PassIf the context node is a document (without element children), inserting a DocumentFragment that contains multiple elements should throw a HierarchyRequestError.
Asserts run
Pass
assert_throws_dom("HierarchyRequestError", function "function() {     doc.replaceChild(df, doc.doctype);   }")
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:128:3)
PassIf the context node is a document, inserting a DocumentFragment with an element if there already is an element child should throw a HierarchyRequestError.
Asserts run
Pass
assert_array_equals(object "[object NodeList]", [DocumentType node, Element node <html><head><title>title</title></head><body></body></html>, Comment node <!--foo-->])
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:138:3)
Pass
assert_throws_dom("HierarchyRequestError", function "function() {     doc.replaceChild(df, comment);   }")
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:142:3)
Pass
assert_throws_dom("HierarchyRequestError", function "function() {     doc.replaceChild(df, doc.doctype);   }")
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:145:3)
PassIf the context node is a document, inserting a DocumentFragment with an element before the doctype should throw a HierarchyRequestError.
Asserts run
Pass
assert_array_equals(object "[object NodeList]", [Comment node <!--foo-->, DocumentType node])
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:154:3)
Pass
assert_throws_dom("HierarchyRequestError", function "function() {     doc.replaceChild(df, comment);   }")
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:158:3)
PassIf the context node is a document, inserting an element if there already is an element child should throw a HierarchyRequestError.
Asserts run
Pass
assert_array_equals(object "[object NodeList]", [DocumentType node, Element node <html><head><title>title</title></head><body></body></html>, Comment node <!--foo-->])
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:167:3)
Pass
assert_throws_dom("HierarchyRequestError", function "function() {     doc.replaceChild(a, comment);   }")
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:170:3)
Pass
assert_throws_dom("HierarchyRequestError", function "function() {     doc.replaceChild(a, doc.doctype);   }")
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:173:3)
PassIf the context node is a document, inserting an element before the doctype should throw a HierarchyRequestError.
Asserts run
Pass
assert_array_equals(object "[object NodeList]", [Comment node <!--foo-->, DocumentType node])
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:181:3)
Pass
assert_throws_dom("HierarchyRequestError", function "function() {     doc.replaceChild(a, comment);   }")
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:184:3)
PassIf the context node is a document, inserting a doctype if there already is a doctype child should throw a HierarchyRequestError.
Asserts run
Pass
assert_array_equals(object "[object NodeList]", [Comment node <!--foo-->, DocumentType node, Element node <html><head><title>title</title></head><body></body></html>])
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:193:3)
Pass
assert_throws_dom("HierarchyRequestError", function "function() {     doc.replaceChild(doctype, comment);   }")
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:196:3)
Pass
assert_throws_dom("HierarchyRequestError", function "function() {     doc.replaceChild(doctype, doc.documentElement);   }")
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:199:3)
PassIf the context node is a document, inserting a doctype after the document element should throw a HierarchyRequestError.
Asserts run
Pass
assert_array_equals(object "[object NodeList]", [Element node <html><head><title>title</title></head><body></body></html>, Comment node <!--foo-->])
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:207:3)
Pass
assert_throws_dom("HierarchyRequestError", function "function() {     doc.replaceChild(doctype, comment);   }")
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:210:3)
PassIf the context node is a DocumentFragment, inserting a document or a doctype should throw a HierarchyRequestError.
Asserts run
Pass
assert_throws_dom("HierarchyRequestError", function "function() {     df.replaceChild(doc, a);   }")
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:221:3)
Pass
assert_throws_dom("HierarchyRequestError", function "function() {     df.replaceChild(doctype, a);   }")
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:226:3)
PassIf the context node is an element, inserting a document or a doctype should throw a HierarchyRequestError.
Asserts run
Pass
assert_throws_dom("HierarchyRequestError", function "function() {     el.replaceChild(doc, a);   }")
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:235:3)
Pass
assert_throws_dom("HierarchyRequestError", function "function() {     el.replaceChild(doctype, a);   }")
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:240:3)
PassReplacing a node with its next sibling should work (2 children)
Asserts run
Pass
assert_array_equals(object "[object NodeList]", [Element node <div></div>, Element node <div></div>])
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:252:3)
Pass
assert_equals(Element node <div></div>, Element node <div></div>)
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:253:3)
Pass
assert_array_equals(object "[object NodeList]", [Element node <div></div>])
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:254:3)
PassReplacing a node with its next sibling should work (4 children)
Asserts run
Pass
assert_array_equals(object "[object NodeList]", [Element node <div></div>, Element node <div></div>, Element node <div></div>, Element node <div></div>])
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:266:3)
Pass
assert_equals(Element node <div></div>, Element node <div></div>)
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:267:3)
Pass
assert_array_equals(object "[object NodeList]", [Element node <div></div>, Element node <div></div>, Element node <div></div>])
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:268:3)
PassReplacing a node with itself should not move the node
Asserts run
Pass
assert_array_equals(object "[object NodeList]", [Element node <div></div>, Element node <div></div>])
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:276:3)
Pass
assert_equals(Element node <div></div>, Element node <div></div>)
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:277:3)
Pass
assert_array_equals(object "[object NodeList]", [Element node <div></div>, Element node <div></div>])
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:278:3)
Pass
assert_equals(Element node <div></div>, Element node <div></div>)
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:279:3)
Pass
assert_array_equals(object "[object NodeList]", [Element node <div></div>, Element node <div></div>])
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:280:3)
PassIf the context node is a document, inserting a new doctype should work.
Asserts run
Pass
assert_array_equals(object "[object NodeList]", [DocumentType node, Element node <html><head><title>title</title></head><body></body></html>])
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:287:3)
Pass
assert_array_equals(object "[object NodeList]", [DocumentType node, Element node <html><head><title>title2</title></head><body></body></html>])
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:291:3)
Pass
assert_array_equals(object "[object NodeList]", [DocumentType node, Element node <html><head><title>title</title></head><body></body></html>])
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:294:3)
Pass
assert_array_equals(object "[object NodeList]", [Element node <html><head><title>title2</title></head><body></body></html>])
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:295:3)
Pass
assert_equals(null, null)
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:296:3)
Pass
assert_equals(Document node with 2 children, Document node with 2 children)
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:297:3)
Pass
assert_equals(Document node with 2 children, Document node with 2 children)
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:298:3)
Pass
assert_equals(Document node with 2 children, Document node with 2 children)
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:299:3)
PassReplacing the document element with a DocumentFragment containing a single element should work.
Asserts run
Pass
assert_equals(Element node <html><head><title>title</title></head><body></body></html>, Element node <html><head><title>title</title></head><body></body></html>)
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:307:3)
Pass
assert_array_equals(object "[object NodeList]", [DocumentType node, Element node <a></a>])
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:308:3)
PassReplacing the document element with a DocumentFragment containing a single element and comments should work.
Asserts run
Pass
assert_equals(Element node <html><head><title>title</title></head><body></body></html>, Element node <html><head><title>title</title></head><body></body></html>)
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:316:3)
Pass
assert_array_equals(object "[object NodeList]", [DocumentType node, Comment node <!--a-->, Element node <b></b>, Comment node <!--c-->])
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:317:3)
PassReplacing the document element with a single element should work.
Asserts run
Pass
assert_equals(Element node <html><head><title>title</title></head><body></body></html>, Element node <html><head><title>title</title></head><body></body></html>)
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:322:3)
Pass
assert_array_equals(object "[object NodeList]", [DocumentType node, Element node <a></a>])
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:323:3)
PassreplaceChild should work in the presence of mutation events.
Asserts run
Pass
assert_equals(Element node <b></b>, Element node <b></b>)
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:330:3)
Pass
assert_equals(null, null)
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:331:3)
Pass
assert_equals(Element node <c></c>, Element node <c></c>)
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:332:3)
Pass
assert_equals(Element node <a><c></c></a>, Element node <a><c></c></a>)
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:333:3)
PassReplacing an element with a DocumentFragment should allow a child of the DocumentFragment to be found by Id.
Asserts run
Pass
assert_equals(Element node <div id="findme"></div>, Element node <div id="findme"></div>, "should not be null")
    at Test.<anonymous> ( /dom/nodes/Node-replaceChild.html:346:3)