summaryrefslogtreecommitdiffstats
path: root/LayoutTests/fast/xpath/preceding-axis.xhtml
diff options
context:
space:
mode:
Diffstat (limited to 'LayoutTests/fast/xpath/preceding-axis.xhtml')
-rw-r--r--LayoutTests/fast/xpath/preceding-axis.xhtml57
1 files changed, 57 insertions, 0 deletions
diff --git a/LayoutTests/fast/xpath/preceding-axis.xhtml b/LayoutTests/fast/xpath/preceding-axis.xhtml
new file mode 100644
index 0000000..6a85afb
--- /dev/null
+++ b/LayoutTests/fast/xpath/preceding-axis.xhtml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+<head>
+<title>XPath preceding axis misses nested elements</title>
+<style>div#msg { white-space: pre; }</style>
+<script>
+if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+window.addEventListener("load", function() {
+ var msg = document.getElementById("msg");
+ function print(s) { msg.textContent += s; }
+ function id(el) { return el.tagName + (el.id ? "#" + el.id : ""); }
+ function query(el, xpath, expected) {
+ print("Query \"" + xpath + "\" from " + id(el) + "\n");
+ var res = document.evaluate(xpath,
+ el,
+ function() { return "http://www.w3.org/1999/xhtml"; },
+ XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,
+ null);
+
+ var resstr = "";
+ for (var i = 0; i &lt; res.snapshotLength; i++) {
+ var el = res.snapshotItem(i);
+ resstr += " " + id(el);
+ }
+ print("Result:" + resstr + "\n");
+ print("Expected: " + expected + "\n");
+ if (resstr != (" " + expected)) {
+ print("***FAIL***\n");
+ } else {
+ print("***SUCCESS***\n");
+ }
+ print("\n");
+ }
+
+ print("Querying in the following...\n\n");
+ print(document.getElementById("test").outerHTML + "\n\n");
+
+ query(document.getElementById("D"), "preceding::xhtml:span", "span#A span#B span#C");
+}, false);
+</script>
+</head>
+<body>
+<div id="test">
+ <span id="A"/>
+ <div>
+ <span id="B">
+ <span id="C"/>
+ </span>
+ </div>
+ <span id="D"/>
+</div>
+<div id="msg"/>
+</body>
+</html>