OLD | NEW |
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../../js/resources/js-test-pre.js"></script> | 4 <script src="../../../js/resources/js-test-pre.js"></script> |
5 </head> | 5 </head> |
6 <body> | 6 <body> |
7 <div id="console"></div> | 7 <div id="console"></div> |
8 | 8 |
9 <script> | 9 <script> |
10 test = '<foo>\ | 10 test = '<foo>\ |
11 <bar>normal text</bar>\ | 11 <bar>normal text</bar>\ |
12 <f>f1</f>\ | 12 <f>f1</f>\ |
13 Free range chickens\ | 13 Free range chickens\ |
14 <bar><![CDATA[<cdatatext>]]></bar>\ | 14 <bar><![CDATA[<cdatatext>]]></bar>\ |
15 <f>f2</f>\ | 15 <f>f2</f>\ |
16 </foo>' | 16 </foo>' |
17 | 17 |
18 doc = (new DOMParser).parseFromString(test, "application/xml"); | 18 doc = (new DOMParser).parseFromString(test, "application/xml"); |
19 | 19 |
20 nodeset = doc.evaluate('//bar/text()', doc, null, XPathResult.UNORDERED_NODE
_SNAPSHOT_TYPE, null); | 20 nodeset = doc.evaluate('//bar/text()', doc, null, XPathResult.UNORDERED_NODE
_SNAPSHOT_TYPE, null); |
21 shouldBe('nodeset.snapshotLength', '2') | 21 shouldBe('nodeset.snapshotLength', '2') |
22 shouldBe('nodeset.snapshotItem(0).nodeValue', '"normal text"') | 22 shouldBe('nodeset.snapshotItem(0).nodeValue', '"normal text"') |
23 shouldBe('nodeset.snapshotItem(1).nodeValue', '"<cdatatext>"') | 23 shouldBe('nodeset.snapshotItem(1).nodeValue', '"<cdatatext>"') |
24 | 24 |
25 nodeset = doc.evaluate('//bar[2]/text()', doc, null, XPathResult.FIRST_ORDER
ED_NODE_TYPE, null); | 25 nodeset = doc.evaluate('//bar[2]/text()', doc, null, XPathResult.FIRST_ORDER
ED_NODE_TYPE, null); |
26 shouldBe('nodeset.singleNodeValue.nodeValue', '"<cdatatext>"') | 26 shouldBe('nodeset.singleNodeValue.nodeValue', '"<cdatatext>"') |
27 | 27 |
28 </script> | 28 </script> |
29 <script src="../../../js/resources/js-test-post.js"></script> | |
30 </body> | 29 </body> |
31 </html> | 30 </html> |
OLD | NEW |