| 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="../../resources/js-test.js"></script> | 4 <script src="../../resources/js-test.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 doc = (new DOMParser).parseFromString( | 10 doc = (new DOMParser).parseFromString( |
| 11 '<?xml version="1.0" encoding="ISO-8859-1"?>' + | 11 '<?xml version="1.0" encoding="ISO-8859-1"?>' + |
| 12 '<!DOCTYPE doc []>' + | 12 '<!DOCTYPE doc []>' + |
| 13 '<?xml-stylesheet "Data" ?>' + | 13 '<?xml-stylesheet "Data" ?>' + |
| 14 '<!' + '-- comment -->' + | 14 '<!' + '-- comment -->' + |
| 15 '<doc attr="<&nbsp;>">0 <elem>1</elem><!' + '-- comment -->a<!
[CDATA[-cdata-]]>b<elem>2</elem><empty></empty></doc>', | 15 '<doc attr="<&nbsp;>">0 <elem>1</elem><!' + '-- comment -->a<!
[CDATA[-cdata-]]>b<elem>2</elem><empty></empty></doc>', |
| 16 'application/xml'); | 16 'application/xml'); |
| 17 | 17 |
| 18 PI = doc.firstChild; | 18 PI = doc.firstChild; |
| 19 while (PI.nodeType != Node.PROCESSING_INSTRUCTION_NODE) | 19 while (PI.nodeType != Node.PROCESSING_INSTRUCTION_NODE) |
| 20 PI = PI.nextSibling; | 20 PI = PI.nextSibling; |
| 21 | 21 |
| 22 COMMENT = doc.firstChild; | 22 COMMENT = doc.firstChild; |
| 23 while (COMMENT.nodeType != Node.COMMENT_NODE) | 23 while (COMMENT.nodeType != Node.COMMENT_NODE) |
| 24 COMMENT = COMMENT.nextSibling; | 24 COMMENT = COMMENT.nextSibling; |
| 25 | 25 |
| 26 ATTR = doc.documentElement.getAttributeNode("attr"); | 26 ATTR = doc.documentElement.getAttributeNode("attr"); |
| 27 | 27 |
| 28 CDATA = doc.documentElement.firstChild; | |
| 29 while (CDATA.nodeType != Node.CDATA_SECTION_NODE) | |
| 30 CDATA = CDATA.nextSibling; | |
| 31 | |
| 32 TEXT = doc.documentElement.firstChild; | 28 TEXT = doc.documentElement.firstChild; |
| 33 | 29 |
| 30 TEXTANDCDATA = doc.documentElement.childNodes[3]; |
| 31 |
| 34 EMPTY = doc.documentElement.lastChild; | 32 EMPTY = doc.documentElement.lastChild; |
| 35 | 33 |
| 36 shouldBe("doc.evaluate('.', doc, null, XPathResult.STRING_TYPE, null).string
Value", "'0 1a-cdata-b2'"); | 34 shouldBe("doc.evaluate('.', doc, null, XPathResult.STRING_TYPE, null).string
Value", "'0 1a-cdata-b2'"); |
| 37 shouldBe("doc.evaluate('.', doc.documentElement, null, XPathResult.STRING_TY
PE, null).stringValue", "'0 1a-cdata-b2'"); | 35 shouldBe("doc.evaluate('.', doc.documentElement, null, XPathResult.STRING_TY
PE, null).stringValue", "'0 1a-cdata-b2'"); |
| 38 shouldBe("doc.evaluate('.', PI, null, XPathResult.STRING_TYPE, null).stringV
alue", "'\"Data\" '"); | 36 shouldBe("doc.evaluate('.', PI, null, XPathResult.STRING_TYPE, null).stringV
alue", "'\"Data\" '"); |
| 39 shouldBe("doc.evaluate('.', COMMENT, null, XPathResult.STRING_TYPE, null).st
ringValue", "' comment '"); | 37 shouldBe("doc.evaluate('.', COMMENT, null, XPathResult.STRING_TYPE, null).st
ringValue", "' comment '"); |
| 40 shouldBe("doc.evaluate('.', CDATA, null, XPathResult.STRING_TYPE, null).stri
ngValue", "'-cdata-'"); | |
| 41 shouldBe("doc.evaluate('.', TEXT, null, XPathResult.STRING_TYPE, null).strin
gValue", "'0 '"); | 38 shouldBe("doc.evaluate('.', TEXT, null, XPathResult.STRING_TYPE, null).strin
gValue", "'0 '"); |
| 39 shouldBe("doc.evaluate('.', TEXTANDCDATA, null, XPathResult.STRING_TYPE, nul
l).stringValue", "'a-cdata-b'"); |
| 42 shouldBe("doc.evaluate('.', EMPTY, null, XPathResult.STRING_TYPE, null).stri
ngValue", "''"); | 40 shouldBe("doc.evaluate('.', EMPTY, null, XPathResult.STRING_TYPE, null).stri
ngValue", "''"); |
| 43 shouldBe("doc.evaluate('.', ATTR, null, XPathResult.STRING_TYPE, null).strin
gValue", "'< >'"); | 41 shouldBe("doc.evaluate('.', ATTR, null, XPathResult.STRING_TYPE, null).strin
gValue", "'< >'"); |
| 44 | 42 |
| 45 </script> | 43 </script> |
| 46 </body> | 44 </body> |
| 47 </html> | 45 </html> |
| OLD | NEW |