1 <!DOCTYPE HTML PUBLIC
"-//IETF//DTD HTML//EN">
4 <script src=
"../../resources/js-test.js"></script>
7 <div id=
"console"></div>
10 doc
= (new DOMParser
).parseFromString("<doc><elem>1</elem><elem>2</elem></doc>", "application/xml");
12 expr
= doc
.createExpression("1", null);
14 shouldBe("expr.evaluate(doc.documentElement.firstChild, XPathResult.STRING_TYPE, null).stringValue", "'1'");
15 shouldBe("expr.evaluate(doc.documentElement.firstChild.nextSibling, XPathResult.STRING_TYPE, null).stringValue", "'1'");
17 expr
= doc
.createExpression(".", null);
19 shouldBe("expr.evaluate(doc.documentElement.firstChild, XPathResult.STRING_TYPE, null).stringValue", "'1'");
20 shouldBe("expr.evaluate(doc.documentElement.firstChild.nextSibling, XPathResult.STRING_TYPE, null).stringValue", "'2'");
22 expr
= doc
.createExpression("string(.)", null);
24 shouldBe("expr.evaluate(doc.documentElement.firstChild, XPathResult.STRING_TYPE, null).stringValue", "'1'");
25 shouldBe("expr.evaluate(doc.documentElement.firstChild.nextSibling, XPathResult.STRING_TYPE, null).stringValue", "'2'");
27 expr
= doc
.createExpression("1 + .", null);
29 shouldBe("expr.evaluate(doc.documentElement.firstChild, XPathResult.NUMBER_TYPE, null).numberValue", "2");
30 shouldBe("expr.evaluate(doc.documentElement.firstChild.nextSibling, XPathResult.NUMBER_TYPE, null).numberValue", "3");