description('Test of normalize on an XML document with CDATA.'); var parser = new DOMParser(); var serializer = new XMLSerializer(); var xmlChunk = parser.parseFromString( '' + 'This is some text before the CDATA' + 'markup inside of a CDATA]]>' + 'This is some text after the CDATA' + '', 'application/xml'); debug('Before normalize'); shouldBe('serializer.serializeToString(xmlChunk)', '"This is some text before the CDATAmarkup inside of a CDATA]]>This is some text after the CDATA"'); shouldBe('xmlChunk.documentElement.childNodes.length', '3'); xmlChunk.documentElement.normalize(); debug('After normalize'); shouldBe('serializer.serializeToString(xmlChunk)', '"This is some text before the CDATAmarkup inside of a CDATA]]>This is some text after the CDATA"'); shouldBe('xmlChunk.documentElement.childNodes.length', '3'); var successfullyParsed = true;