<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="../base.css" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/strict.dtd">
<html xmlns="http://www.w3.org/TR/REC-html40" lang="en-US">

<!--XXX namespace was xhtml1, and should probably be -->

<head>
<title>DOM Test Suite: Interface Node (extended interfaces)</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="copyright" href="http://dbaron.org/legal.html" />

<!--XXX Should this work in XHTML: ?? - It doesn't -->

<link rel="stylesheet" type="text/css" href="../base.css" />
<script type="text/javascript" src="base.js" />

<!-- XXX we're getting no response to the HTML dom, only Core -->

<script type="text/javascript"><![CDATA[

function testNode() {

	var ulistE = document.getElementsByTagName("ul").item(0);
	var firstE = document.getElementsByTagName("li").item(0);
	var secondE = document.getElementsByTagName("li").item(1);
	var thirdE = document.getElementsByTagName("li").item(2);
	var fourthE = document.getElementsByTagName("li").item(3);
outText(document.getElementsByTagName("li").length);

	var secondA = secondE.getAttributeNode("class");
	var thirdT = thirdE.firstChild;
	var fourthC = fourthE.firstChild;

	var scriptE = document.getElementsByTagName("script").item(1);
		// second script element in document

	// I don't work with these yet:
	var scriptCDATA = scriptE.firstChild;

	outTaggedText("header", "Testing nodeName:");
	shouldBe("ulistE.nodeName", ulistE.nodeName, "ul", "ul" );
	shouldNotBe("ulistE.nodeName", ulistE.nodeName, "li", "li" );
	shouldBe("firstE.nodeName", firstE.nodeName, "li", "li" );
	shouldBe("secondE.nodeName", secondE.nodeName, "li", "li" );
	shouldBe("thirdE.nodeName", thirdE.nodeName, "li", "li" );
	shouldBe("fourthE.nodeName", fourthE.nodeName, "li", "li" );
	shouldNotBe("fourthE.nodeName", fourthE.nodeName, "", "" );

	shouldBe("secondA.nodeName", secondA.nodeName, "class", "class" );
	shouldBe("thirdT.nodeName", thirdT.nodeName, "#text", "#text" );
	shouldBe("fourthC.nodeName", fourthC.nodeName, "#comment", "#comment" );
	shouldBe("document.nodeName", document.nodeName, "#document", "#document" );
	shouldBe("document.doctype.nodeName", document.doctype.nodeName, "html", "html" );
	shouldNotBe("thirdT.nodeName", thirdT.nodeName, "", "" );
	shouldNotBe("fourthC.nodeName", fourthC.nodeName, "", "" );

	outTaggedText("header", "Testing nodeValue:");

	shouldBe("ulistE.nodeValue", ulistE.nodeValue, "null", null );
	shouldBe("firstE.nodeValue", firstE.nodeValue, "null", null );
	shouldBe("secondE.nodeValue", secondE.nodeValue, "null", null );
	shouldBe("thirdE.nodeValue", thirdE.nodeValue, "null", null );
	shouldBe("fourthE.nodeValue", fourthE.nodeValue, "null", null );
	shouldNotBe("thirdE.nodeValue", thirdE.nodeValue, "li", "li" );

	shouldBe("secondA.nodeValue", secondA.nodeValue, "afterfirst", "afterfirst" );
	shouldBe("thirdT.nodeValue", thirdT.nodeValue, "third text", "third text" );
	shouldNotBe("thirdT.nodeValue", thirdT.nodeValue, "null", null );
	shouldBe("fourthC.nodeValue", fourthC.nodeValue, " A comment ", " A comment " );
	shouldBe("document.nodeValue", document.nodeValue, "null", null );
	shouldBe("document.doctype.nodeValue", document.doctype.nodeValue, "null", null );

	outTaggedText("header", "Testing nodeType:");

	// shouldBe("firstE.nodeType", firstE.nodeType, "ELEMENT_NODE", ELEMENT_NODE);
	shouldBe("firstE.nodeType", firstE.nodeType, "1", 1);
	// shouldBe("secondA.nodeType", secondA.nodeType, "ATTRIBUTE_NODE", ATTRIBUTE_NODE);
	shouldBe("secondA.nodeType", secondA.nodeType, "2", 2);
	// shouldBe("thirdT.nodeType", thirdT.nodeType, "TEXT_NODE", TEXT_NODE);
	shouldBe("thirdT.nodeType", thirdT.nodeType, "3", 3);
	// shouldBe("fourthC.nodeType", fourthC.nodeType, "COMMENT_NODE", COMMENT_NODE);
	shouldBe("fourthC.nodeType", fourthC.nodeType, "8", 8);
	shouldNotBe("fourthC.nodeType", fourthC.nodeType, "7", 7);
	shouldBe("document.nodeType", document.nodeType, "9",9);
	shouldBe("document.doctype.nodeType", document.doctype.nodeType, "10",10);

	outTaggedText("header", "Testing parentNode:");
	shouldBe("firstE.parentNode", firstE.parentNode, "ulistE", ulistE );
	shouldBe("secondE.parentNode", secondE.parentNode, "ulistE", ulistE );
	shouldNotBe("secondE.parentNode", secondE.parentNode, "null", null );
	shouldBe("thirdE.parentNode", thirdE.parentNode, "ulistE", ulistE );
	shouldBe("fourthE.parentNode", fourthE.parentNode, "ulistE", ulistE );
	shouldBe("secondA.parentNode", secondA.parentNode, "null", null );
	shouldNotBe("secondA.parentNode", secondA.parentNode, "secondE", secondE );
	shouldBe("thirdT.parentNode", thirdT.parentNode, "thirdE", thirdE );
	shouldBe("fourthC.parentNode", fourthC.parentNode, "fourthE", fourthE );
	shouldBe("document.parentNode", document.parentNode, "null", null );
	shouldBe("document.doctype.parentNode", document.doctype.parentNode, "document", document );


	outTaggedText("header", "Testing firstChild:");

	shouldBe("ulistE.firstChild", ulistE.firstChild, "firstE", firstE);
	shouldBe("thirdT.firstChild", thirdT.firstChild, "null", null);

	// MORE TESTS HERE...

	outTaggedText("header", "Testing lastChild:");

	shouldBe("ulistE.lastChild", ulistE.lastChild, "fourthE", fourthE);
	shouldBe("thirdT.lastChild", thirdT.lastChild, "null", null);

	// MORE TESTS HERE...

	outTaggedText("header", "Testing previousSibling:");

	shouldBe("firstE.previousSibling", firstE.previousSibling, "null", null);
	shouldBe("secondE.previousSibling", secondE.previousSibling, "firstE", firstE);
	// MORE TESTS HERE...

	outTaggedText("header", "Testing nextSibling:");

	shouldBe("fourthE.nextSibling", fourthE.nextSibling, "null", null);
	shouldBe("secondE.nextSibling", secondE.nextSibling, "thirdE", thirdE);
	// MORE TESTS HERE...

	outTaggedText("header", "Testing attributes:");
	shouldBe("thirdE.attributes.length", thirdE.attributes.length, "1", 1);
	shouldBe("secondA.attributes", secondA.attributes, "null", null);
	shouldBe("thirdT.attributes", thirdT.attributes, "null", null);
	shouldBe("fourthC.attributes", fourthC.attributes, "null", null);
	shouldBe("document.attributes", document.attributes, "null", null);
	shouldBe("document.doctype.attributes", document.doctype.attributes, "null", null);

	outTaggedText("header", "Testing ownerDocument:");
	shouldBe("secondE.ownerDocument", secondE.ownerDocument,
	         "document", document);
	shouldBe("thirdE.ownerDocument", thirdE.ownerDocument,
	         "fourthC.ownerDocument", fourthC.ownerDocument);

	shouldNotBe("secondA.ownerDocument.documentElement", secondA.ownerDocument.documentElement, "null", null);

	shouldBe("thirdT.ownerDocument.ownerDocument", thirdT.ownerDocument.ownerDocument, "null", null);
	shouldBe("document.doctype.ownerDocument", document.doctype.ownerDocument,
	         "document", document);

	outTaggedText("header", "Testing hasChildNodes():");

	shouldBe("thirdT.hasChildNodes()", thirdT.hasChildNodes(), "false", false);
	shouldBe("firstE.hasChildNodes()", firstE.hasChildNodes(), "true", true);

	outTaggedText("header", "Finished passive tests.");


	outTaggedText("header", "Testing doctype:");

}

]]></script>
</head>
<body>
<h1>DOM Test Suite: Interface Node (extended interfaces)</h1>

<form method="get" action="dummy.cgi">
 <div>
  <input type="button" onclick="testNode()" value="test Node" />
 </div>
</form>

<!--XXX Scratch this for _extended test: -->

<div id="testarea">
<h2>Testing Area</h2>

<ul id="ulist"><li id="first">first text</li><li id="second" class="afterfirst">second text</li><li id="third">third text</li><li id="fourth"><!-- A comment -->fourth text</li></ul>

</div>

<div id="output">
<h2>Output:</h2>

</div>

<hr title="Beginning of Footer" />
<p><a href="http://validator.w3.org/check/referer" title="W3C HTML Validator"><img src="../../../images/vh40" alt="Valid HTML 4.0!" height="31" width="88" /></a></p>
<p>(Back to
<a href="../">DOM Testing Information</a>,
<a href="../../../">David Baron</a>)</p>
<p><a href="/~dbaron/" title="David Baron's Homepage">LDB</a>,
<a rev="made" href="mailto:dbaron@fas.harvard.edu" title="Send e-mail to David Baron">dbaron@fas.harvard.edu</a></p>

</body></html>
