summaryrefslogtreecommitdiff
path: root/test/js/dom-node-nodetype.html
blob: 09775f3785345d59030fdcf7ec0c55b2e6c9a5da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<!DOCTYPE html>
<html>
<head><title>DOM Node::nodeType</title></head>
<body>
<h1>Node::nodeType</h1>
<h2>These should all resolve to true.</h2>
<noscript><p>Javascript is disabled</p></noscript>
<script>
document.write("<p>document is Node.DOCUMENT_NODE: ",
               document.nodeType === Node.DOCUMENT_NODE, "</p>");
document.write("<p>document.body is Node.ELEMENT_NODE: ",
               document.body.nodeType === Node.ELEMENT_NODE, "</p>");
document.write("<p>document.body.firstChild is Node.TEXT_NODE: ",
               document.body.firstChild.nodeType === Node.TEXT_NODE, "</p>");
document.write("<p>document.body.firstChild.nextSibling is Node.ELEMENT_NODE: ",
               document.body.firstChild.nextSibling.nodeType === Node.ELEMENT_NODE, "</p>");
document.write("<p>document.body.firstChild.nextSibling.firstChild is Node.TEXT_NODE: ",
               document.body.firstChild.nextSibling.firstChild.nodeType === Node.TEXT_NODE, "</p>");
</script>
<h2>These should all resolve to false.</h2>
<script>
document.write("<p>document is Node.ELEMENT_NODE: ",
               document.nodeType === Node.ELEMENT_NODE, "</p>");
document.write("<p>document.body is Node.TEXT_NODE: ",
               document.body.nodeType === Node.TEXT_NODE, "</p>");
document.write("<p>document.body.firstChild is Node.ELEMENT_NODE: ",
               document.body.firstChild.nodeType === Node.ELEMENT_NODE, "</p>");
document.write("<p>document.body.firstChild.nextSibling is Node.DOCUMENT_NODE: ",
               document.body.firstChild.nextSibling.nodeType === Node.DOCUMENT_NODE, "</p>");
document.write("<p>document.body.firstChild.nextSibling.firstChild is Node.ELEMENT_NODE: ",
               document.body.firstChild.nextSibling.firstChild.nodeType === Node.ELEMENT_NODE, "</p>");
</script>
</body>
</html>