dom: DocumentHTML getters

This commit is contained in:
Pierre Tachoire
2024-01-03 16:23:26 +01:00
parent c812ff300a
commit ea80e5e4a1
2 changed files with 48 additions and 0 deletions

View File

@@ -1450,3 +1450,19 @@ pub inline fn documentHTMLBody(doc_html: *DocumentHTML) !?*Body {
if (body == null) return null;
return @as(*Body, @ptrCast(body.?));
}
pub fn documentHTMLGetDomain(doc: *DocumentHTML) ![]const u8 {
var s: ?*String = undefined;
const err = documentHTMLVtable(doc).get_domain.?(doc, &s);
try DOMErr(err);
if (s == null) return "";
return strToData(s.?);
}
pub fn documentHTMLGetReferrer(doc: *DocumentHTML) ![]const u8 {
var s: ?*String = undefined;
const err = documentHTMLVtable(doc).get_referrer.?(doc, &s);
try DOMErr(err);
if (s == null) return "";
return strToData(s.?);
}