revision:
createCDATASection() creates a new CDATA section node, and returns it.
Note: createCDATASection is intended for XML and will not work for HTML documents.
createCDATASection(data)
Parameters:
data : a string containing the data to be added to the CDATA Section.
const docu = new DOMParser().parseFromString("<xml></xml>", "application/xml");
const cdata = docu.createCDATASection("Some <CDATA> data & then some");
docu.querySelector("xml").appendChild(cdata);
console.log(new XMLSerializer().serializeToString(docu));
// Displays: *lt;xml> data & then some]]></xml>