blob: a920ccbdfebb00fe6bc7b4e09d7bbb1405229efa [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<div id="console"></div>
<script>
doc = (new DOMParser).parseFromString("<doc><elem>1</elem><elem>2</elem></doc>", "application/xml");
expr = doc.createExpression("1", null);
shouldBe("expr.evaluate(doc.documentElement.firstChild, XPathResult.STRING_TYPE, null).stringValue", "'1'");
shouldBe("expr.evaluate(doc.documentElement.firstChild.nextSibling, XPathResult.STRING_TYPE, null).stringValue", "'1'");
expr = doc.createExpression(".", null);
shouldBe("expr.evaluate(doc.documentElement.firstChild, XPathResult.STRING_TYPE, null).stringValue", "'1'");
shouldBe("expr.evaluate(doc.documentElement.firstChild.nextSibling, XPathResult.STRING_TYPE, null).stringValue", "'2'");
expr = doc.createExpression("string(.)", null);
shouldBe("expr.evaluate(doc.documentElement.firstChild, XPathResult.STRING_TYPE, null).stringValue", "'1'");
shouldBe("expr.evaluate(doc.documentElement.firstChild.nextSibling, XPathResult.STRING_TYPE, null).stringValue", "'2'");
expr = doc.createExpression("1 + .", null);
shouldBe("expr.evaluate(doc.documentElement.firstChild, XPathResult.NUMBER_TYPE, null).numberValue", "2");
shouldBe("expr.evaluate(doc.documentElement.firstChild.nextSibling, XPathResult.NUMBER_TYPE, null).numberValue", "3");
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>