<?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" "http://www.w3.org/TR/xhtml1/DTD/strict.dtd"-->

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

<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<title>DOM Test Suite: Interface ProcessingInstruction</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 testProcessingInstruction() {
	if ( ! ( canOutputWarn() &&
	         existsWarn("document") &&
	         existsWarn("document.createProcessingInstruction")
	       )) {
		return;
	}

	pi = document.createProcessingInstruction(
		"xml-stylesheet",
		"href='ProcessingInstruction_style' type='text/css'");

	shouldBe("pi.nodeName", '"xml-stylesheet"');
	shouldBe("pi.nodeValue",
		'"href=\'ProcessingInstruction_style\' type=\'text/css\'"');
	shouldBe("pi.nodeType", "7");
	shouldBe("pi.parentNode", "null");
	shouldNotBe("pi.childNodes", "null");
	if (notNullWarn("pi.childNodes")) {
		shouldBe("pi.childNodes.length", "0");
	}
	shouldBe("pi.firstChild", "null");
	shouldBe("pi.lastChild", "null");
	shouldBe("pi.previousSibling", "null");
	shouldBe("pi.nextSibling", "null");
	shouldBe("pi.attributes", "null");
	shouldBe("pi.ownerDocument", "document");
	shouldBe("pi.target", '"xml-stylesheet"');
	shouldBe("pi.data",
		'"href=\'ProcessingInstruction_style\' type=\'text/css\'"');


	first = document.firstChild;
	shouldBe("first.nodeName", '"xml-stylesheet"');
	shouldBe("first.nodeValue", '"type=\'text/css\' href=\'../base.css\' "');
	shouldBe("first.nodeType", "7");
	shouldBe("first.parentNode", "document");
	shouldNotBe("first.childNodes", "null");
	if (notNullWarn("first.childNodes")) {
		shouldBe("first.childNodes.length", "0");
	}
	shouldBe("first.firstChild", "null");
	shouldBe("first.lastChild", "null");
	shouldBe("first.previousSibling", "null");
	shouldBe("first.nextSibling.nodeType", "7");
	shouldBe("first.nextSibling.nextSibling", "document.doctype");
	shouldBe("first.attributes", "null");
	shouldBe("first.ownerDocument", "document");
	shouldBe("first.target", '"xml-stylesheet"');
	shouldBe("first.data", '"type=\'text/css\' href=\'../base.css\' "');

	document.insertBefore(pi, first);

	shouldBe("pi.parentNode", "document");

	// test that no effect unless inserted... using second stylesheet...
	pitwo = document.createProcessingInstruction(
		"xml-stylesheet",
		"href='ProcessingInstruction_style2' type='text/css'");
	// not inserting, thus shouldn't do anything!
	pithree = document.createProcessingInstruction(
		"xml-stylesheet",
		"href='ProcessingInstruction_style3' type='text/css'");
	pifour = document.createProcessingInstruction(
		"xml-stylesheet",
		"href='ProcessingInstruction_style4' type='text/css'");

	document.insertBefore(pithree, pi); // pithree is frist stylesheet
	document.insertBefore(pifour, first);

	outText("The 'First test' above should have white text on a green background, but the 'Second test' should NOT have white text on a red background.");

	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-1004215813">ProcessingInstruction</a></h1>

<div>
	<input type="button" onclick="testProcessingInstruction()" value="test ProcessingInstruction" />
</div>

<h2>Testing area</h2>

<p class="test">First test</p>

<p class="test2">Second test</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>
