summaryrefslogtreecommitdiffstats
path: root/LayoutTests/fast/xpath/attribute-node-predicate.html
blob: a1661aef990bd4db38432160d6e3cb4ab164c566 (plain)
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
<!DOCTYPE html>
<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>
<div id="console"></div>

<script>

var ROOT = document.createElement('div');
ROOT.innerHTML = '<p>a</p><div><span id="21"></span><span id="22"></span><span id="23"></span></div>';
var CHILD1 = ROOT.firstChild;
var CHILD1TEXT = CHILD1.firstChild;
var CHILD2 = ROOT.lastChild;
var CHILD21 = CHILD2.firstChild;
var CHILD22 = CHILD21.nextSibling;
var CHILD23 = CHILD22.nextSibling;

    result = document.evaluate(".//@id[false]", ROOT, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
    checkSnapshot("//@id[false]", result, []);

    result = document.evaluate(".//@id[1]/parent::*", ROOT, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
    checkSnapshot("//@id[1]/parent::*", result, [CHILD21, CHILD22, CHILD23]);

    result = document.evaluate(".//@id[2]/parent::*", ROOT, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
    checkSnapshot("//@id[2]/parent::*", result, []);

    result = document.evaluate(".//@id[string()='21']/parent::*", ROOT, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
    checkSnapshot("//@id[string()='21']/parent::*", result, [CHILD21]);

    result = document.evaluate(".//@id[string()='22']/parent::*", ROOT, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
    checkSnapshot("//@id[string()='22']/parent::*", result, [CHILD22]);

    var successfullyParsed = true;

</script>
<script src="../js/resources/js-test-post.js"></script>
</body>
</html>