@@ -895,6 +895,15 @@ pub const HTMLLinkElement = struct {
895895 pub fn constructor (page : * Page , js_this : Env.JsThis ) ! * parser.Element {
896896 return constructHtmlElement (page , js_this );
897897 }
898+
899+ pub fn get_href (self : * parser.Link ) ! []const u8 {
900+ return try parser .linkGetHref (self );
901+ }
902+
903+ pub fn set_href (self : * parser.Link , href : []const u8 , page : * const Page ) ! void {
904+ const full = try urlStitch (page .call_arena , href , page .url .raw , .{});
905+ return try parser .linkSetHref (self , full );
906+ }
898907};
899908
900909pub const HTMLMapElement = struct {
@@ -1581,6 +1590,16 @@ test "Browser.HTML.Element" {
15811590 .{ "document.createElement('a').focus()" , null },
15821591 .{ "document.activeElement === focused" , "true" },
15831592 }, .{});
1593+
1594+ try runner .testCases (&.{
1595+ .{ "let l2 = document.createElement('link');" , null },
1596+ .{ "l2.href" , "" },
1597+ .{ "l2.href = 'https://lightpanda.io/opensource-browser/15'" , null },
1598+ .{ "l2.href" , "https://lightpanda.io/opensource-browser/15" },
1599+
1600+ .{ "l2.href = '/over/9000'" , null },
1601+ .{ "l2.href" , "https://lightpanda.io/over/9000" },
1602+ }, .{});
15841603}
15851604
15861605test "Browser.HTML.Element.DataSet" {
0 commit comments