diff options
Diffstat (limited to 'LayoutTests/fast/dom/Node/script-tests/normalize-with-cdata.js')
-rw-r--r-- | LayoutTests/fast/dom/Node/script-tests/normalize-with-cdata.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/LayoutTests/fast/dom/Node/script-tests/normalize-with-cdata.js b/LayoutTests/fast/dom/Node/script-tests/normalize-with-cdata.js new file mode 100644 index 0000000..d1e3efe --- /dev/null +++ b/LayoutTests/fast/dom/Node/script-tests/normalize-with-cdata.js @@ -0,0 +1,22 @@ +description('Test of normalize on an XML document with CDATA.'); + +var parser = new DOMParser(); +var serializer = new XMLSerializer(); + +var xmlChunk = parser.parseFromString( + '<foo>' + + 'This is some text before the CDATA' + + '<![CDATA[This is some <bold>markup</bold> inside of a CDATA]]>' + + 'This is some text after the CDATA' + + '</foo>', + 'application/xml'); + +debug('Before normalize'); +shouldBe('serializer.serializeToString(xmlChunk)', '"<foo>This is some text before the CDATA<![CDATA[This is some <bold>markup</bold> inside of a CDATA]]>This is some text after the CDATA</foo>"'); +shouldBe('xmlChunk.documentElement.childNodes.length', '3'); +xmlChunk.documentElement.normalize(); +debug('After normalize'); +shouldBe('serializer.serializeToString(xmlChunk)', '"<foo>This is some text before the CDATA<![CDATA[This is some <bold>markup</bold> inside of a CDATA]]>This is some text after the CDATA</foo>"'); +shouldBe('xmlChunk.documentElement.childNodes.length', '3'); + +var successfullyParsed = true; |