<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="../base.css" ?>
<?xml-stylesheet type="text/css" href="../basexml.css" ?>
<!--DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "https://umn0mtkzgkj46tygt32g.julianrbryant.com/TR/xhtml1/DTD/strict.dtd"-->
<html xmlns="https://umn0mtkzgkj46tygt32g.julianrbryant.com/1999/xhtml" lang="en-US">
<head>
<title>DOM Test Suite: Interface Node (extended interfaces)</title>
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="copyright" href="https://umn56zbhyq5tevr.julianrbryant.com/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() {

	if ( ! ( canOutputWarn() &&  existsWarn("document") && existsWarn("document.getElementsByTagName"))) {
		return;
	}

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

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

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

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

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

	shouldBe("secondA.nodeName",'"class"');
	shouldBe("thirdT.nodeName",'"#text"');
	shouldBe("fourthC.nodeName",'"#comment"');
	shouldBe("document.nodeName",'"#document"');
	if ( notNullWarn("document.doctype") ) { // for Mozilla
		shouldBe("document.doctype.nodeName",'"html"');
	}
	shouldNotBe("thirdT.nodeName",'""');
	shouldNotBe("fourthC.nodeName",'""');

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

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

	shouldBe("secondA.nodeValue",'"afterfirst"');
	shouldBe("thirdT.nodeValue",'"third text"');
	shouldNotBe("thirdT.nodeValue","null");
	shouldBe("fourthC.nodeValue",'" A comment "');
	shouldBe("document.nodeValue","null");
	if ( notNullWarn("document.doctype") ) { // for Mozilla
		shouldBe("document.doctype.nodeValue","null");
	}

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

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

	outTaggedText("header", "Testing parentNode:");
	shouldBe("firstE.parentNode","ulistE");
	shouldBe("secondE.parentNode","ulistE");
	shouldNotBe("secondE.parentNode","null");
	shouldBe("thirdE.parentNode","ulistE");
	shouldBe("fourthE.parentNode","ulistE");
	shouldBe("secondA.parentNode","null");
	shouldNotBe("secondA.parentNode","secondE");
	shouldBe("thirdT.parentNode","thirdE");
	shouldBe("fourthC.parentNode","fourthE");
	shouldBe("document.parentNode","null");
	if ( notNullWarn("document.doctype") ) { // for Mozilla
		shouldBe("document.doctype.parentNode","document");
	}


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

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

	// MORE TESTS HERE...

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

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

	// MORE TESTS HERE...

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

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

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

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

	outTaggedText("header", "Testing attributes:");
	shouldBe("thirdE.attributes.length","1");
	shouldBe("secondA.attributes","null");
	shouldBe("thirdT.attributes","null");
	shouldBe("fourthC.attributes","null");
	shouldBe("document.attributes","null");
	if ( notNullWarn("document.doctype") ) { // for Mozilla
		shouldBe("document.doctype.attributes","null");
	}

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

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

	shouldBe("thirdT.ownerDocument.ownerDocument","null");
	if ( notNullWarn("document.doctype") ) { // for Mozilla
		shouldBe("document.doctype.ownerDocument","document");
	}

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

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

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


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

	outTaggedText("header", "Tests finished (but not all written).");

}

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

<div>
	<input type="button" onclick="testNode()" value="test Node" />
</div>

<!--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>(Back to
<a href="../">DOM Testing Information</a>,
<a href="../../../">David Baron</a>)</p>
<p><a href="/" 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>
