<?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"-->
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<title>DOM Test Suite: Interface Attr</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 testAttr() {

	TEXT_NODE = 3;
	ENTITY_REFERENCE_NODE = 5;

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

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

	shouldBe("pelem.attributes.length", "2");
	shouldBe("pelem.getAttribute('class')","'att>rib'");
	shouldBe("pelem.getAttribute('title')","'seven < eight'");

	classone = pelem.attributes.getNamedItem("class");
	titleone = pelem.attributes.getNamedItem("title");
	classtwo = pelem.getAttributeNode("class");
	titletwo = pelem.getAttributeNode("title");
	shouldBe("classone", "classtwo");
	shouldBe("titleone", "titletwo");

	shouldBe("classone.name", "'class'");
	shouldBe("classone.nodeName", "'class'");
	shouldBe("titleone.name", "'title'");
	shouldBe("titleone.nodeName", "'title'");
	shouldBe("classone.value", "'att>rib'");
	shouldBe("classone.nodeValue", "'att>rib'");
	shouldBe("titleone.value", "'seven < eight'");
	shouldBe("titleone.nodeValue", "'seven < eight'");
	shouldBe("classone.specified", "true");
	shouldBe("titleone.specified", "true");
	shouldBe("classtwo.name", "'class'");
	shouldBe("classtwo.nodeName", "'class'");
	shouldBe("titletwo.name", "'title'");
	shouldBe("titletwo.nodeName", "'title'");
	shouldBe("classtwo.value", "'att>rib'");
	shouldBe("classtwo.nodeValue", "'att>rib'");
	shouldBe("titletwo.value", "'seven < eight'");
	shouldBe("titletwo.nodeValue", "'seven < eight'");
	shouldBe("classtwo.specified", "true");
	shouldBe("titletwo.specified", "true");

	// test child nodes of attributes

	shouldBe("classone.childNodes.length", "3");
	if ( notNullWarn("classone.childNodes.item(0)")
	  && notNullWarn("classone.childNodes.item(1)")
	  && notNullWarn("classone.childNodes.item(2)")
	  ) {
		shouldBe("classone.childNodes.item(0).nodeType", "TEXT_NODE");
		shouldBe("classone.childNodes.item(1).nodeType", "ENTITY_REFERENCE_NODE");
		shouldBe("classone.childNodes.item(2).nodeType", "ENTITY_REFERENCE_NODE");
		shouldBe("classone.childNodes.item(0).nodeValue", "att");
		shouldBe("classone.childNodes.item(1).nodeName", "gt");
		shouldBe("classone.childNodes.item(2).data", "rib");
	}

	// test setting of attributes by different methods

	// test some of HTML's implied attributes:

	outTaggedText("header", "Tests finished, but I'm not done writing them...");

}

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

<div>
	<input type="button" onclick="testAttr()" value="test Attr" />
</div>

<h2>Testing Area</h2>

<p class="att&gt;rib" title="seven &lt; eight" />

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