1
0
Fork 0
firefox/testing/web-platform/tests/domparsing/xml-parse-serialize-roundtrip.html
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

36 lines
1.7 KiB
HTML

<!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>