Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: LayoutTests/fast/dom/Node/script-tests/normalize-with-cdata.js

Issue 739433003: Remove CDATASection (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 description('Test of normalize on an XML document with CDATA.'); 1 description('Test of normalize on an XML document with CDATA.');
2 2
3 var parser = new DOMParser(); 3 var parser = new DOMParser();
4 var serializer = new XMLSerializer(); 4 var serializer = new XMLSerializer();
5 5
6 var xmlChunk = parser.parseFromString( 6 var xmlChunk = parser.parseFromString(
7 '<foo>' + 7 '<foo>' +
8 'This is some text before the CDATA' + 8 'This is some text before the CDATA' +
9 '<![CDATA[This is some <bold>markup</bold> inside of a CDATA]]>' + 9 // The parser converts CDATA to Text, so the script converts this comment to CDATA.
10 '<!--This is some <bold>markup</bold> inside of a CDATA-->' +
10 'This is some text after the CDATA' + 11 'This is some text after the CDATA' +
11 '</foo>', 12 '</foo>',
12 'application/xml'); 13 'application/xml');
13 14
15 var comment = xmlChunk.documentElement.childNodes[1];
16 var cdata = document.implementation.createDocument(null, null).createCDATASectio n(comment.data);
17 xmlChunk.documentElement.replaceChild(cdata, comment);
18
14 debug('Before normalize'); 19 debug('Before normalize');
15 shouldBe('serializer.serializeToString(xmlChunk)', '"<foo>This is some text befo re the CDATA<![CDATA[This is some <bold>markup</bold> inside of a CDATA]]>This i s some text after the CDATA</foo>"'); 20 shouldBe('serializer.serializeToString(xmlChunk)', '"<foo>This is some text befo re the CDATA<![CDATA[This is some <bold>markup</bold> inside of a CDATA]]>This i s some text after the CDATA</foo>"');
16 shouldBe('xmlChunk.documentElement.childNodes.length', '3'); 21 shouldBe('xmlChunk.documentElement.childNodes.length', '3');
17 xmlChunk.documentElement.normalize(); 22 xmlChunk.documentElement.normalize();
18 debug('After normalize'); 23 debug('After normalize');
19 shouldBe('serializer.serializeToString(xmlChunk)', '"<foo>This is some text befo re the CDATA<![CDATA[This is some <bold>markup</bold> inside of a CDATA]]>This i s some text after the CDATA</foo>"'); 24 shouldBe('serializer.serializeToString(xmlChunk)', '"<foo>This is some text befo re the CDATA<![CDATA[This is some <bold>markup</bold> inside of a CDATA]]>This i s some text after the CDATA</foo>"');
20 shouldBe('xmlChunk.documentElement.childNodes.length', '3'); 25 shouldBe('xmlChunk.documentElement.childNodes.length', '3');
OLDNEW
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/fast/dom/SelectorAPI/resig-SelectorsAPI-test.xhtml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698