Reviewed by Darin.
[WebKit-https.git] / LayoutTests / fast / xpath / 4XPath / Core / test_predicate_list.html
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <link rel="stylesheet" href="../../../js/resources/js-test-style.css">
5 <script src="../../../js/resources/js-test-pre.js"></script>
6 <script src="test.js"></script>
7 </head>
8 <body>
9 <div id="console"></div>
10
11 <script>
12     result = DOM.evaluate("self::node()[true() and false()][true()]", ROOT, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
13     checkSnapshot("self::node()[true() and false()][true()]", result, []);
14
15     result = DOM.evaluate("self::node()[true() or false()][true()]", ROOT, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
16     checkSnapshot("self::node()[true() or false()][true()]", result, [ROOT]);
17
18     dom2 = (new DOMParser).parseFromString(
19         "<?xml version='1.0'?>" +
20         "<elementList>" +
21         "    <element>" +
22         "        <x>" +
23         "           <y>a</y>" +
24         "        </x>" +
25         "    </element>" +
26         "    <element>" +
27         "        <x>" +
28         "            <y>z</y>" +
29         "        </x>" +
30         "    </element>" +
31         "</elementList>",
32         "application/xml");
33
34     result = dom2.evaluate("//element[descendant::y[.='z']]", dom2, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
35     checkSnapshot("//element[descendant::y[.='z']]", result, [dom2.getElementsByTagName("element")[1]]);
36
37     result = dom2.evaluate("//element[descendant::y[.='z']][1]", dom2, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
38     checkSnapshot("//element[descendant::y[.='z']][1]", result, [dom2.getElementsByTagName("element")[1]]);
39
40     result = dom2.evaluate("//element[descendant::y[.='z']][2]", dom2, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
41     checkSnapshot("//element[descendant::y[.='z']][2]", result, []);
42
43     var successfullyParsed = true;
44
45 </script>
46 <script src="../../../js/resources/js-test-post.js"></script>
47 </body>
48 </html>