summaryrefslogtreecommitdiffstats
path: root/LayoutTests/fast/dom/Node/script-tests/normalize-with-cdata.js
blob: d1e3efe7afbe3c3c9959b6ee8da2393b0b3dbf5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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;