blob: 2dce29fc02ddfb024d12a48225071ec0a7357707 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<link rel="stylesheet" href="../js/resources/js-test-style.css">
<script src="../js/resources/js-test-pre.js"></script>
</head>
<body>
<div id="console"></div>
<script>
doc = (new DOMParser).parseFromString(
'<?xml version="1.0" encoding="ISO-8859-1"?>' +
'<!DOCTYPE doc []>' +
'<?xml-stylesheet "Data" ?>' +
'<!' + '-- comment -->' +
'<doc attr="&lt;&amp;nbsp;>">0 <elem>1</elem><!' + '-- comment -->a<![CDATA[-cdata-]]>b<elem>2</elem><empty></empty></doc>',
'application/xml');
PI = doc.firstChild;
while (PI.nodeType != Node.PROCESSING_INSTRUCTION_NODE)
PI = PI.nextSibling;
COMMENT = doc.firstChild;
while (COMMENT.nodeType != Node.COMMENT_NODE)
COMMENT = COMMENT.nextSibling;
ATTR = doc.documentElement.getAttributeNode("attr");
CDATA = doc.documentElement.firstChild;
while (CDATA.nodeType != Node.CDATA_SECTION_NODE)
CDATA = CDATA.nextSibling;
TEXT = doc.documentElement.firstChild;
EMPTY = doc.documentElement.lastChild;
shouldBe("doc.evaluate('.', doc, null, XPathResult.STRING_TYPE, null).stringValue", "'0 1a-cdata-b2'");
shouldBe("doc.evaluate('.', doc.documentElement, null, XPathResult.STRING_TYPE, null).stringValue", "'0 1a-cdata-b2'");
shouldBe("doc.evaluate('.', PI, null, XPathResult.STRING_TYPE, null).stringValue", "'\"Data\" '");
shouldBe("doc.evaluate('.', COMMENT, null, XPathResult.STRING_TYPE, null).stringValue", "' comment '");
shouldBe("doc.evaluate('.', CDATA, null, XPathResult.STRING_TYPE, null).stringValue", "'-cdata-'");
shouldBe("doc.evaluate('.', TEXT, null, XPathResult.STRING_TYPE, null).stringValue", "'0 '");
shouldBe("doc.evaluate('.', EMPTY, null, XPathResult.STRING_TYPE, null).stringValue", "''");
shouldBe("doc.evaluate('.', ATTR, null, XPathResult.STRING_TYPE, null).stringValue", "'<&nbsp;>'");
var successfullyParsed = true;
</script>
<script src="../js/resources/js-test-post.js"></script>
</body>
</html>