</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 352728 **/
function checkTypes(aNode, aNodeType, aTypeArray)
{
for (var i = 0; i < aTypeArray.length; ++i) {
ok(aNode instanceof aTypeArray[i],
`${aNodeType} type test ${i}: ${aNodeType} should be a ${aTypeArray[i]}`);
}
}
function testCharacterData(aNode, aText)
{
is(aNode.length, aText.length, "Text length should match");
is(aNode.data, aText, "Text content should match");
is(aNode.nodeValue, aText, "Check nodeValue");
is(aNode.localName, undefined, "Check localName")
is(aNode.namespaceURI, undefined, "Check namespaceURI");
}
function testComment(aText)
{
try { var comment = document.createComment(aText); var types = [ Comment, CharacterData, Node ];
checkTypes(comment, "comment", types);
testComment("Some text");
testComment("Some text with a '-' in it");
testComment("Some text with a '-' and a '-' and another '-'");
testComment("Some text -- this should create a node!");
testComment("");
testCDATASection("Some text", true);
testCDATASection("Some text with a '?' in it", true);
testCDATASection("Some text with a '>' in it", true);
testCDATASection("Some text with a '?' and a '>' in it", true);
testCDATASection("Some text with a '? >' in it", true);
testCDATASection("Some text -- ?> this should be ok", true);
testCDATASection("Some text ]]> this should not create a node!", false);
testPI("foo", "bar", true);
testPI("foo:bar", "baz", true);
testPI("foo", "bar?", true);
testPI("foo", "bar>", true);
testPI("foo", "bar? >", true);
testPI(", "bar", false, "Target should not contain '<'");
testPI("aaa>", "bar", false, "Target should not contain '>'");
testPI("aa?", "bar", false, "Target should not contain '?'");
testPI("foo", "bar?>", false, "Data should not contain '?>'");
</script>
</pre>
</body>
</html>
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.