dom: implement document.createAttribute

This commit is contained in:
Pierre Tachoire
2023-12-07 17:36:34 +01:00
parent 82148da5f6
commit f0149b03e5
2 changed files with 16 additions and 0 deletions

View File

@@ -1192,6 +1192,13 @@ pub inline fn documentAdoptNode(doc: *Document, node: *Node) !*Node {
return @as(*Node, @ptrCast(res));
}
pub inline fn documentCreateAttribute(doc: *Document, name: []const u8) !*Attribute {
var attr: ?*Attribute = undefined;
const err = documentVtable(doc).dom_document_create_attribute.?(doc, try strFromData(name), &attr);
try DOMErr(err);
return attr.?;
}
// DocumentHTML
pub const DocumentHTML = c.dom_html_document;