| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> |
| <div id="foodiv"><!foo id="foo"></!foo></div> |
| <div id="doctypediv"><!doctype id="doctype"></!doctype></div> |
| var fooDiv = document.getElementById("foodiv"); |
| var doctypeDiv = document.getElementById("doctypediv"); |
| var fooList = document.getElementsByName("!foo"); |
| var doctypeList = document.getElementsByName("!doctype"); |
| var foo = document.getElementById("foo"); |
| var doctype = document.getElementById("doctype"); |
| document.writeln("<p>!foo elements count: " + fooList.length + "</p>"); |
| document.writeln("<p>!doctype elements count: " + doctypeList.length + "</p>"); |
| document.writeln("<p>!foo with id \"foo\": " + foo + "</p>"); |
| document.writeln("<p>!doctype with id \"doctype\": " + doctype + "</p>"); |
| document.writeln("<p>!foo div child count: " + fooDiv.childNodes.length + "</p>"); |
| var node = fooDiv.firstChild; |
| document.writeln("<p>child " + ++count + " -- nodeName: " + node.nodeName + " nodeValue: " + node.nodeValue + "</p>"); |
| document.writeln("<p>!doctype div child count: " + doctypeDiv.childNodes.length + "</p>"); |
| node = doctypeDiv.firstChild; |
| document.writeln("<p>child " + ++count + " -- nodeName: " + node.nodeName + " nodeValue: " + node.nodeValue + "</p>"); |