Baseline Widely available
createCDATASection()
å建并è¿åä¸ä¸ªæ°ç CDATA çæ®µèç¹ã
var CDATASectionNode = document.createCDATASection(data);
var docu = new DOMParser().parseFromString("<xml></xml>", "application/xml");
var cdata = docu.createCDATASection("Some <CDATA> data & then some");
docu.getElementsByTagName("xml")[0].appendChild(cdata);
alert(new XMLSerializer().serializeToString(docu));
// Displays: <xml><![CDATA[Some <CDATA> data & then some]]></xml>
夿³¨
NOT_SUPPORTED_ERR
.NS_ERROR_DOM_INVALID_CHARACTER_ERR
exception if one tries to submit the closing CDATA sequence ("]]>
") as part of the data, so unescaped user-provided data cannot be safely used without with this method getting this exception (createTextNode()
can often be used in its place).RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4