1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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>
|