dom: add document.createCDATASection

This commit is contained in:
Pierre Tachoire
2023-12-07 16:27:26 +01:00
parent 894b6182cf
commit 94876d01f1
5 changed files with 34 additions and 0 deletions

View File

@@ -791,6 +791,9 @@ pub fn characterDataSubstringData(cdata: *CharacterData, offset: u32, count: u32
return strToData(s.?);
}
// CDATASection
pub const CDATASection = c.dom_cdata_section;
// Text
pub const Text = c.dom_text;
@@ -1144,6 +1147,13 @@ pub inline fn documentCreateTextNode(doc: *Document, s: []const u8) !*Text {
return txt.?;
}
pub inline fn documentCreateCDATASection(doc: *Document, s: []const u8) !*CDATASection {
var cdata: ?*CDATASection = undefined;
const err = documentVtable(doc).dom_document_create_cdata_section.?(doc, try strFromData(s), &cdata);
try DOMErr(err);
return cdata.?;
}
// DocumentHTML
pub const DocumentHTML = c.dom_html_document;