1 This tests that various combinations of replaceChild on the document works as specified.
3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
6 replacing element with element
7 PASS doc.replaceChild(newChild, doc.documentElement) did not throw exception.
10 replacing element with element in fragment
11 PASS doc.replaceChild(fragment, doc.documentElement); did not throw exception.
14 replacing element with multiple elements in fragment
15 PASS doc.replaceChild(fragment, doc.documentElement); threw exception HierarchyRequestError: Failed to execute 'replaceChild' on 'Node': Only one element on document allowed..
16 <!DOCTYPE html><body/>
18 replacing element with doctype
19 PASS doc.replaceChild(newChild, doc.documentElement) did not throw exception.
20 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
22 replacing element with doctype when a doctype already exists
23 PASS doc.replaceChild(newChild, doc.documentElement) threw exception HierarchyRequestError: Failed to execute 'replaceChild' on 'Node': Only one doctype on document allowed..
24 <!DOCTYPE html><body/>
26 replacing doctype with doctype
27 PASS doc.replaceChild(newChild, doc.doctype) did not throw exception.
28 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><body/>
30 replacing doctype with element
31 PASS doc.replaceChild(newChild, doc.doctype) did not throw exception.
34 replacing element with doctype when an element already exists
35 PASS doc.replaceChild(newChild, doc.documentElement) threw exception HierarchyRequestError: Failed to execute 'replaceChild' on 'Node': Only one doctype on document allowed..
36 <!DOCTYPE html><body/>
38 PASS successfullyParsed is true