summaryrefslogtreecommitdiffstats
path: root/LayoutTests/fast/xpath/text-nodes.html
diff options
context:
space:
mode:
Diffstat (limited to 'LayoutTests/fast/xpath/text-nodes.html')
-rw-r--r--LayoutTests/fast/xpath/text-nodes.html56
1 files changed, 56 insertions, 0 deletions
diff --git a/LayoutTests/fast/xpath/text-nodes.html b/LayoutTests/fast/xpath/text-nodes.html
new file mode 100644
index 0000000..96a9e38
--- /dev/null
+++ b/LayoutTests/fast/xpath/text-nodes.html
@@ -0,0 +1,56 @@
+<body>
+<script>
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ src = '<doc><elem>a<![CDATA[b]]>c</elem></doc>';
+ doc = (new DOMParser).parseFromString(src, "application/xml");
+
+ elem = doc.documentElement.firstChild;
+ aText = elem.firstChild;
+ bText = elem.firstChild.nextSibling;
+ cText = elem.lastChild;
+
+ function test(expr, context) {
+ nodeset = doc.evaluate(expr, context, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null);
+ str = "";
+ while (currNode = nodeset.iterateNext()) {
+ if (str)
+ str += " ";
+ str += currNode.nodeValue;
+ }
+
+ document.write(expr + ", " + (context.nodeValue ? context.nodeValue : context) + ": \"" + str + "\"<br>");
+ }
+
+ document.write("<xmp>" + src + "</xmp>");
+
+ test("child::*", elem);
+ test("child::node()", elem);
+ test("descendant::*", elem);
+ test("descendant::node()", elem);
+ test("descendant::node()[2]", elem);
+ test("ancestor-or-self::node()", bText);
+ test("ancestor-or-self::*", bText);
+ test("ancestor-or-self::node()", aText);
+ test("ancestor-or-self::*", aText);
+ test("following::node()", elem);
+ test("following::node()", aText);
+ test("following::text()", aText);
+ test("following::node()", bText);
+ test("following-sibling::node()", elem);
+ test("following-sibling::node()", aText);
+ test("following-sibling::text()", aText);
+ test("following-sibling::node()", bText);
+ test("preceding::node()", bText);
+ test("preceding-sibling::node()", bText);
+ test("preceding::node()", cText);
+ test("preceding::text()", cText);
+ test("preceding-sibling::node()", cText);
+ test("preceding-sibling::text()", cText);
+ test("self::node()", bText);
+
+ var successfullyParsed = true;
+
+</script>
+</body>