4 <script src=
"../../resources/js-test.js"></script>
5 <script src=
"xpath-test-pre.js"></script>
8 <div id=
"console"></div>
12 var ROOT
= document
.createElement('div');
13 ROOT
.innerHTML
= '<p>a</p><div><span id="21"></span><span id="22"></span><span id="23"></span></div>';
14 var CHILD1
= ROOT
.firstChild
;
15 var CHILD1TEXT
= CHILD1
.firstChild
;
16 var CHILD2
= ROOT
.lastChild
;
17 var CHILD21
= CHILD2
.firstChild
;
18 var CHILD22
= CHILD21
.nextSibling
;
19 var CHILD23
= CHILD22
.nextSibling
;
21 result
= document
.evaluate(".//@id[false]", ROOT
, null, XPathResult
.ORDERED_NODE_SNAPSHOT_TYPE
, null);
22 checkSnapshot("//@id[false]", result
, []);
24 result
= document
.evaluate(".//@id[1]/parent::*", ROOT
, null, XPathResult
.ORDERED_NODE_SNAPSHOT_TYPE
, null);
25 checkSnapshot("//@id[1]/parent::*", result
, [CHILD21
, CHILD22
, CHILD23
]);
27 result
= document
.evaluate(".//@id[2]/parent::*", ROOT
, null, XPathResult
.ORDERED_NODE_SNAPSHOT_TYPE
, null);
28 checkSnapshot("//@id[2]/parent::*", result
, []);
30 result
= document
.evaluate(".//@id[string()='21']/parent::*", ROOT
, null, XPathResult
.ORDERED_NODE_SNAPSHOT_TYPE
, null);
31 checkSnapshot("//@id[string()='21']/parent::*", result
, [CHILD21
]);
33 result
= document
.evaluate(".//@id[string()='22']/parent::*", ROOT
, null, XPathResult
.ORDERED_NODE_SNAPSHOT_TYPE
, null);
34 checkSnapshot("//@id[string()='22']/parent::*", result
, [CHILD22
]);