| <!DOCTYPE html> |
| <link rel=author href="mailto:jarhar@chromium.org"> |
| <link rel=help href="https://issues.chromium.org/issues/327273585"> |
| <link rel=help href="https://issues.chromium.org/issues/41101979"> |
| <script src="/resources/testharness.js"></script> |
| <script src="/resources/testharnessreport.js"></script> |
| |
| <script> |
| function runTest(xmlString, testName) { |
| test(() => { |
| const xmlDoc = (new DOMParser()).parseFromString(xmlString, 'text/xml'); |
| const result = (new XMLSerializer()).serializeToString(xmlDoc); |
| assert_equals(result, xmlString); |
| }, `DOMParser and XMLSerializer should round trip with CDATA sections: ${testName}`); |
| } |
| |
| runTest( |
| `<root><![CDATA[ |
| 12345678901234567890123456789012345678901234567890123456789012345678901234567890 |
| 12345678901234567890123456789012345678901234567890123456789012345678901234567890 |
| 12345678901234567890123456789012345678901234567890123456789012345678901234567890 |
| 12345678901234567890123456789012345678901234567890123456789012345678901234567890 |
| 12345678901234567890123456789012345678901234567890123456789012345678901234567890 |
| 12345678901234567890123456789012345678901234567890123456789012345678901234567890 |
| 12345678901234567890123456789012345678901234567890123456789012345678901234567890 |
| 12345678901234567890123456789012345678901234567890123456789012345678901234567890 |
| 12345678901234567890123456789012345678901234567890123456789012345678901234567890 |
| 12345678901234567890123456789012345678901234567890123456789012345678901234567890 |
| 12345678901234567890123456789012345678901234567890123456789012345678901234567890 |
| ]]></root>`, |
| 'large CDATA'); |
| |
| runTest( |
| '<root><htmlDefn><![CDATA[<div><![CDATA[ Just Rubbish Data $#$^#^$ ]]]]><![CDATA[></div><div></div>]]></htmlDefn></root>', |
| 'multiple CDATAs'); |
| </script> |