add rel getter to HTMLLinkElement

This commit is contained in:
nikneym
2025-09-22 15:08:07 +03:00
parent a8e5a48b87
commit 68585c8837
2 changed files with 12 additions and 0 deletions

View File

@@ -757,6 +757,10 @@ pub const HTMLLinkElement = struct {
pub const prototype = *HTMLElement;
pub const subtype = .node;
pub fn get_rel(self: *parser.Link) ![]const u8 {
return try parser.linkGetRel(self);
}
pub fn get_href(self: *parser.Link) ![]const u8 {
return try parser.linkGetHref(self);
}

View File

@@ -1934,6 +1934,14 @@ pub fn anchorSetRel(a: *Anchor, rel: []const u8) !void {
// HTMLLinkElement
pub fn linkGetRel(link: *Link) ![]const u8 {
var res: ?*String = null;
const err = c.dom_html_link_element_get_rel(link, &res);
try DOMErr(err);
if (res == null) return "";
return strToData(res.?);
}
pub fn linkGetHref(link: *Link) ![]const u8 {
var res: ?*String = null;
const err = c.dom_html_link_element_get_href(link, &res);