mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 23:58:11 +00:00
LibWeb: Implement document.createCDATASection()
This commit is contained in:
parent
ee6b0e144a
commit
02c2b1e67e
6 changed files with 45 additions and 1 deletions
21
Tests/LibWeb/Text/input/DOM/Document-createCDATASection.html
Normal file
21
Tests/LibWeb/Text/input/DOM/Document-createCDATASection.html
Normal file
|
@ -0,0 +1,21 @@
|
|||
<script src="../include.js"></script>
|
||||
<script>
|
||||
test(() => {
|
||||
const xmlDocument = new DOMParser().parseFromString("<xml></xml>", "application/xml");
|
||||
const validCdata = xmlDocument.createCDATASection("Some <CDATA> data & then some");
|
||||
xmlDocument.querySelector("xml").appendChild(validCdata);
|
||||
println(new XMLSerializer().serializeToString(xmlDocument));
|
||||
|
||||
try {
|
||||
document.createCDATASection("This isn't valid for HTML documents")
|
||||
} catch (e) {
|
||||
println(`Exception: ${e.name}`);
|
||||
}
|
||||
|
||||
try {
|
||||
const cdataWithAnEndDelimiter = xmlDocument.createCDATASection("This: ']]>' is a CDATA end delimiter");
|
||||
} catch (e) {
|
||||
println(`Exception: ${e.name}`);
|
||||
}
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue