dom: add document.createElement and document.getElementById

This commit is contained in:
Pierre Tachoire
2023-10-11 14:48:31 +02:00
parent f3601f1245
commit 6370b2d7a7
3 changed files with 29 additions and 10 deletions

View File

@@ -671,6 +671,16 @@ pub inline fn documentCreateElement(doc: *Document, tag_name: []const u8) *Eleme
return elem.?;
}
pub inline fn documentBody(doc: *Document) ?*Body {
const dochtml = @as(*DocumentHTML, @ptrCast(doc));
var body: ?*ElementHTML = undefined;
_ = documentHTMLVtable(dochtml).get_body.?(dochtml, &body);
if (body == null) {
return null;
}
return @as(*Body, @ptrCast(body.?));
}
// DocumentHTML
pub const DocumentHTML = c.dom_html_document;