summaryrefslogtreecommitdiffstats
path: root/LayoutTests/fast/xpath/reverse-axes.html
diff options
context:
space:
mode:
Diffstat (limited to 'LayoutTests/fast/xpath/reverse-axes.html')
-rw-r--r--LayoutTests/fast/xpath/reverse-axes.html43
1 files changed, 43 insertions, 0 deletions
diff --git a/LayoutTests/fast/xpath/reverse-axes.html b/LayoutTests/fast/xpath/reverse-axes.html
new file mode 100644
index 0000000..71f7357
--- /dev/null
+++ b/LayoutTests/fast/xpath/reverse-axes.html
@@ -0,0 +1,43 @@
+<!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>
+<script src="xpath-test-pre.js"></script>
+</head>
+<body>
+<p>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=15436">bug 15436</a>:
+Wrong proximity positions for XPath reverse axes.</p>
+
+<div id="d">
+ <div id="d1"></div>
+ <div id="d2">
+ <div id="d21"></div>
+ </div>
+ <div id="d3">
+ <div id="d31"></div>
+ </div>
+</div>
+
+<div id="console"></div>
+
+<script>
+
+ shouldBe("document.evaluate('preceding-sibling::*[1]', document.getElementById('d3'), null, XPathResult.ANY_UNORDERED_NODE_TYPE, null).singleNodeValue.id", "'d2'");
+
+ shouldBe("document.evaluate('preceding::*[1]', document.getElementById('d31'), null, XPathResult.ANY_UNORDERED_NODE_TYPE, null).singleNodeValue.id", "'d21'");
+ shouldBe("document.evaluate('preceding::*[2]', document.getElementById('d31'), null, XPathResult.ANY_UNORDERED_NODE_TYPE, null).singleNodeValue.id", "'d2'");
+ shouldBe("document.evaluate('preceding::*[3]', document.getElementById('d31'), null, XPathResult.ANY_UNORDERED_NODE_TYPE, null).singleNodeValue.id", "'d1'");
+ shouldBe("document.evaluate('preceding::*[4]', document.getElementById('d31'), null, XPathResult.ANY_UNORDERED_NODE_TYPE, null).singleNodeValue.tagName", "'A'");
+ shouldBe("document.evaluate('preceding::*[5]', document.getElementById('d31'), null, XPathResult.ANY_UNORDERED_NODE_TYPE, null).singleNodeValue.tagName", "'P'");
+
+ shouldBe("document.evaluate('ancestor::*[1]', document.getElementById('d31'), null, XPathResult.ANY_UNORDERED_NODE_TYPE, null).singleNodeValue.id", "'d3'");
+
+ shouldBe("document.evaluate('ancestor-or-self::*[1]', document.getElementById('d31'), null, XPathResult.ANY_UNORDERED_NODE_TYPE, null).singleNodeValue.id", "'d31'");
+
+ var successfullyParsed = true;
+
+</script>
+<script src="../js/resources/js-test-post.js"></script>
+</body>
+</html>