<?xml version="1.0"?>

<!-- Work done for Netscape.  Public domain. -->

<?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"
		"http://www.w3.org/TR/xhtml1/DTD/strict.dtd"
	[
		<!ENTITY myent "This is an entity.">

		<!ENTITY HTMLlat1 PUBLIC
			"-//W3C//ENTITIES Latin1//EN//HTML"
			"http://www.w3.org/TR/xhtml1/DTD/HTMLlat1x.ent">

		<!ENTITY HTMLsymbol SYSTEM
			"http://www.w3.org/TR/xhtml1/DTD/HTMLsymbolx.ent">

		<!NOTATION gif
			PUBLIC "GIF Notation">

		<!ENTITY banner
			SYSTEM "http://www.mozilla.org/images/mozilla-banner.gif"
			NDATA gif>

	]
>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<title>DOM Test Suite: Interface EntityReference</title>
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="copyright" href="http://dbaron.org/legal.html" />
<link rel="stylesheet" type="text/css" href="../base.css" />
<script type="text/javascript" src="../base.js" />
<script type="text/javascript"><![CDATA[

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

	pelem = document.getElementsByTagName("p").item(0);
	entref = document.createEntityReference("myent");

	if ( ! ( existsWarn("entref") &&
			 notNullWarn("entref") &&
	         existsWarn("entref.nodeType") ) ) {
		return;
	}

	shouldBe("entref.nodeName", "myent");
	shouldBe("entref.nodeValue", "null");
	shouldBe("entref.nodeType", "5");
	shouldBe("entref.parentNode", "null");
	tnode = entref.childNodes.item(0);
	shouldBe("tnode.nodeType", "3");
	shouldBe("tnode.data", "This is an entity.");
	shouldBe("entref.firstChild", "tnode");
	shouldBe("entref.firstChild.nodeType", "3");
	shouldBe("entref.firstChild.nodeValue", "This is an entity.");
	shouldBe("entref.lastChild", "tnode");
	shouldBe("entref.previousSibling", "null");
	shouldBe("entref.nextSibling", "null");
	shouldBe("entref.attributes", "null");
	shouldBe("entref.ownerDocument", "document");

	outText("Node functions not yet tested...");

	shouldBe("entref.publicId", "null");
	shouldBe("entref.systemId", "null");
	shouldBe("entref.notationName", "null");

	pelem.appendChild(entref);
	shouldBe("entref.parentNode", "pelem");

	outText("You should now see, above, the text 'This is an entity.'");

	entref = document.createEntityReference("HTMLlat1");
	shouldBe("entref.nodeType", "5");
	shouldBe("entref.nodeName", "HTMLlat1");
	shouldBe("entref.nodeValue", "null");
	shouldBe("entref.publicId",
	         "-//W3C//ENTITIES Latin1//EN//HTML");
	shouldBe("entref.systemId",
	         "http://www.w3.org/TR/xhtml1/DTD/HTMLlat1x.ent");
	shouldBe("entref.notationName", "null");

	entref = document.createEntityReference("HTMLsymbol");
	shouldBe("entref.nodeType", "5");
	shouldBe("entref.nodeName", "HTMLsymbol");
	shouldBe("entref.nodeValue", "null");
	shouldBe("entref.publicId", "null");
	shouldBe("entref.systemId",
	         "http://www.w3.org/TR/xhtml1/DTD/HTMLsymbolx.ent");
	shouldBe("entref.notationName", "null");

	entref = document.createEntityReference("banner");
	shouldBe("entref.nodeType", "5");
	shouldBe("entref.nodeName", "banner");
	shouldBe("entref.nodeValue", "null");
	shouldBe("entref.publicId", "null");
	shouldBe("entref.systemId",
	         "http://www.mozilla.org/images/mozilla-banner.gif");
	shouldBe("entref.notationName", "gif");

	outTaggedText("header", "Tests finished.");
}

]]></script>
</head>
<body>
<h1>DOM Test Suite: Interface <a href="http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-11C98490">EntityReference</a></h1>

<div>
	<input type="button" onclick="testEntityReference()" value="test EntityReference" />
</div>

<h2>Testing area</h2>

<p/>

<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>
