Reviewed by Darin.
[WebKit-https.git] / LayoutTests / fast / xpath / 4XPath / Borrowed / rs_20010831.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 </head>
7 <body>
8 <div id="console"></div>
9
10 <script>
11 test = '<foo>\
12     <bar>normal text</bar>\
13     <f>f1</f>\
14     Free range chickens\
15     <bar><![CDATA[<cdatatext>]]></bar>\
16     <f>f2</f>\
17 </foo>'
18
19     doc = (new DOMParser).parseFromString(test, "application/xml");
20
21     nodeset = doc.evaluate('//bar/text()', doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
22     shouldBe('nodeset.snapshotLength', '2')
23     shouldBe('nodeset.snapshotItem(0).nodeValue', '"normal text"')
24     shouldBe('nodeset.snapshotItem(1).nodeValue', '"<cdatatext>"')
25
26     nodeset = doc.evaluate('//bar[2]/text()', doc, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
27     shouldBe('nodeset.singleNodeValue.nodeValue', '"<cdatatext>"')
28
29     var successfullyParsed = true;
30
31 </script>
32 <script src="../../../js/resources/js-test-post.js"></script>
33 </body>
34 </html>