diff options
Diffstat (limited to 'LayoutTests/fast/xpath/4XPath/Borrowed/namespace-nodes.html')
-rw-r--r-- | LayoutTests/fast/xpath/4XPath/Borrowed/namespace-nodes.html | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/LayoutTests/fast/xpath/4XPath/Borrowed/namespace-nodes.html b/LayoutTests/fast/xpath/4XPath/Borrowed/namespace-nodes.html new file mode 100644 index 0000000..e3bfa91 --- /dev/null +++ b/LayoutTests/fast/xpath/4XPath/Borrowed/namespace-nodes.html @@ -0,0 +1,56 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> +<html> +<body> +<p>Tests that accessing XPath namespace axis doesn't cause a crash, see +<a href="bug http://bugs.webkit.org/show_bug.cgi?id=12724">bug 12724</a>.</p> +<p>The actual results are incorrect, because XPath namespace nodes are not implemented yet.</p> + +<div id="console"></div> + +<script> +SRC_1 = '<?xml version="1.0" encoding="utf-8"?>\ +<docu>\ +<elem xmlns:unused="urn:uuu000"/>\ +<elem xmlns="urn:sss111"/>\ +<y:elem xmlns:y="urn:yyyy222"/>\ +</docu>' + + if (window.layoutTestController) + layoutTestController.dumpAsText(); + + function shouldBe(actual, expected) { + if (actual == expected) + document.write("PASS: " + actual + " result nodes<br>"); + else + document.write("FAILURE: " + actual + " result nodes (should be " + expected + ")<br>"); + } + + doc = (new DOMParser).parseFromString(SRC_1, "application/xml"); + + EXPR = '//namespace::node()' + nodeset = doc.evaluate(EXPR, doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); + shouldBe(nodeset.snapshotLength, 7) + + EXPR = '//node()/namespace::node()' + nodeset = doc.evaluate(EXPR, doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); + shouldBe(nodeset.snapshotLength, 7) + + EXPR = '//*/namespace::node()' + nodeset = doc.evaluate(EXPR, doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); + shouldBe(nodeset.snapshotLength, 7) + + EXPR = '/*/*/namespace::node()' + nodeset = doc.evaluate(EXPR, doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); + shouldBe(nodeset.snapshotLength, 6) + + EXPR = '/*/namespace::node()|/*/*/namespace::node()' + nodeset = doc.evaluate(EXPR, doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); + shouldBe(nodeset.snapshotLength, 7) + + EXPR = '//*' + nodeset = doc.evaluate(EXPR, doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); + shouldBe(nodeset.snapshotLength, 4) + +</script> +</body> +</html> |