<?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" "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 Comment</title>
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="copyright" href="https://umn56zbhyq5tevr.julianrbryant.com/legal.html" />
<link rel="stylesheet" type="text/css" href="../base.css" />
<script type="text/javascript" src="../base.js" />
<script type="text/javascript"><![CDATA[

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

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

	outTaggedText("header", "Testing the characterData interface:");

	shouldBe("mycomment.nodeType", "8");

	shouldBe("mycomment.data", "'This is some text in a paragraph.'");
	shouldBe("mycomment.nodeValue", "'This is some text in a paragraph.'");
	shouldBe("mycomment.length", "33");
	shouldBe("mycomment.substringData(6,5)", "'s som'");
	shouldBe("mycomment.substringData(27,12)", "'graph.'");

	outText("Testing insertData()");
	mycomment.insertData(0, "These words are");
	shouldBe("mycomment.data", "'These words areThis is some text in a paragraph.'");
	mycomment.insertData(28, "words");
	shouldBe("mycomment.data", "'These words areThis is some wordstext in a paragraph.'");
	mycomment.insertData(53, "!");
	shouldBe("mycomment.data", "'These words areThis is some wordstext in a paragraph.!'");

	outText("Testing appendData()");
	mycomment.appendData("?");
	shouldBe("mycomment.data", "'These words areThis is some wordstext in a paragraph.!?'");
	
	outText("Testing deleteData()");
	mycomment.deleteData(15, 12);
	shouldBe("mycomment.data", "'These words are wordstext in a paragraph.!?'");
	mycomment.deleteData(40, 12);
	shouldBe("mycomment.data", "'These words are wordstext in a paragraph'");
	mycomment.deleteData(5, 0); // does nothing.
	shouldBe("mycomment.data", "'These words are wordstext in a paragraph'");
	mycomment.deleteData(40, 10); // does nothing.
	shouldBe("mycomment.data", "'These words are wordstext in a paragraph'");

	outText("Testing replaceData()");
	mycomment.replaceData(21, 11, " in a p"); 
	shouldBe("mycomment.data", "'These words are words in a paragraph'");
	mycomment.replaceData(33, 11, "aph..."); 
	shouldBe("mycomment.data", "'These words are words in a paragraph...'");
	mycomment.replaceData(39, 11, ", etc."); 
	shouldBe("mycomment.nodeValue", "'These words are words in a paragraph..., etc.'");
	shouldBe("mycomment.data", "'These words are words in a paragraph..., etc.'");

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

}

]]></script>
</head>
<body>
<h1>DOM Test Suite: Interface <a href="https://umn0mtkzgkj46tygt32g.julianrbryant.com/TR/REC-DOM-Level-1/level-one-core.html#ID-1312295772">Comment</a></h1>

<div>
	<input type="button" onclick="testComment()" value="test Comment" />
</div>

<h2>Testing area</h2>

<p><!--This is some text in a paragraph.--></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>
