@@ -154,7 +154,39 @@ pub const HTMLAnchorElement = struct {
154154 }
155155
156156 pub fn set_href (self : * parser.Anchor , href : []const u8 ) ! void {
157- return try parser .anchorSetTarget (self , href );
157+ return try parser .anchorSetHref (self , href );
158+ }
159+
160+ pub fn get_hreflang (self : * parser.Anchor ) ! []const u8 {
161+ return try parser .anchorGetHrefLang (self );
162+ }
163+
164+ pub fn set_hreflang (self : * parser.Anchor , href : []const u8 ) ! void {
165+ return try parser .anchorSetHrefLang (self , href );
166+ }
167+
168+ pub fn get_type (self : * parser.Anchor ) ! []const u8 {
169+ return try parser .anchorGetType (self );
170+ }
171+
172+ pub fn set_type (self : * parser.Anchor , t : []const u8 ) ! void {
173+ return try parser .anchorSetType (self , t );
174+ }
175+
176+ pub fn get_rel (self : * parser.Anchor ) ! []const u8 {
177+ return try parser .anchorGetRel (self );
178+ }
179+
180+ pub fn set_rel (self : * parser.Anchor , t : []const u8 ) ! void {
181+ return try parser .anchorSetRel (self , t );
182+ }
183+
184+ pub fn get_text (self : * parser.Anchor ) ! ? []const u8 {
185+ return try parser .nodeTextContent (parser .anchorToNode (self ));
186+ }
187+
188+ pub fn set_text (self : * parser.Anchor , v : []const u8 ) ! void {
189+ return try parser .nodeSetTextContent (parser .anchorToNode (self ), v );
158190 }
159191};
160192
@@ -627,8 +659,23 @@ pub fn testExecFn(
627659 .{ .src = "let a = document.getElementById('link')" , .ex = "undefined" },
628660 .{ .src = "a.target" , .ex = "" },
629661 .{ .src = "a.target = '_blank'" , .ex = "_blank" },
662+ .{ .src = "a.target" , .ex = "_blank" },
663+ .{ .src = "a.target = ''" , .ex = "" },
664+
630665 .{ .src = "a.href" , .ex = "foo" },
631666 .{ .src = "a.href = 'https://lightpanda.io/'" , .ex = "https://lightpanda.io/" },
667+ .{ .src = "a.href" , .ex = "https://lightpanda.io/" },
668+ .{ .src = "a.href = 'foo'" , .ex = "foo" },
669+
670+ .{ .src = "a.type" , .ex = "" },
671+ .{ .src = "a.type = 'text/html'" , .ex = "text/html" },
672+ .{ .src = "a.type" , .ex = "text/html" },
673+ .{ .src = "a.type = ''" , .ex = "" },
674+
675+ .{ .src = "a.text" , .ex = "OK" },
676+ .{ .src = "a.text = 'foo'" , .ex = "foo" },
677+ .{ .src = "a.text" , .ex = "foo" },
678+ .{ .src = "a.text = 'OK'" , .ex = "OK" },
632679 };
633680 try checkCases (js_env , & anchor );
634681}
0 commit comments