This is the first paragraph. I deliberately left out all empty text nodes.
This is the second paragraph that starts with an underline. This
paragraph is element x
and contains a
strong tag that is element y
which is
directly followed by an em tag
This is the third paragraph. It's preceded by a comment.
This page tests walking the DOM tree with the Traversal module.
Test firstChild
. The correct answers are <U>
and <code>
,
respectively.
alert(x.firstElementChild.nodeName)
alert(y.firstElementChild.nodeName)
Test lastElementChild
. The correct answers are <EM>
and <CODE>
,
respectively.
alert(x.lastElementChild.nodeName)
alert(y.lastElementChild.nodeName)
Test nextElementSibling
. The correct answers are <P>
and <EM>
,
respectively.
alert(x.nextElementSibling.nodeName)
alert(y.nextElementSibling.nodeName)
Test previousElementSibling
. The correct answers are <P>
and
<CODE>
, respectively.
alert(x.previousElementSibling.nodeName)
alert(y.previousElementSibling.nodeName)
The correct answers are 4 and 1, respectively.
alert(x.childElementCount)
alert(y.childElementCount)