This tests that the appendChild method of the
Node interface works correctly.
The test has been passed if six blue rectangles are displayed.
Each rectangle indicates the result of a different aspect of
appendChild behavior being tested:
-
The first is a test of appending a newly created rect that
is not yet in the document tree.
-
The second is a test of appending a rect that is already
somewhere else in the document tree. In its initial position, it
inherits fill='red', and in its new position, it inherits
fill='blue'.
-
The third is a test of appending a rect to its current
parent. This results in the rect being moved to the
final position in the list of child nodes. In its initial
position, a red rect occludes this blue one. In its final
position, this blue rect occludes the red one.
-
The fourth is a test of appending a second element to the document
node. This results in a DOMException being thrown with code
HIERARCHY_REQUEST_ERR. If this exception is thrown, the
rect is changed from red to blue.
-
The fifth is a test of appending an element to one of its
descendant elements. This also results in a DOMException being
thrown with code HIERARCHY_REQUEST_ERR. If this exception is
thrown, the rect is changed from red to blue.
-
The sixth is a test of appending an element. The element is obtained
by calling parseXML. A DOMException must not be thrown.
If an exception is thrown, the
rect is changed from blue to red.