node: add baseURI getter

This commit is contained in:
Pierre Tachoire
2025-08-08 15:20:01 +02:00
parent 3d0928a449
commit 7ffdee0d7f

View File

@@ -111,6 +111,9 @@ pub const Node = struct {
// --------
// Read-only attributes
pub fn get_baseURI(_: *parser.Node, page: *Page) ![]const u8 {
return page.url.raw;
}
pub fn get_firstChild(self: *parser.Node) !?Union {
const res = try parser.nodeFirstChild(self);
@@ -737,6 +740,10 @@ test "Browser.DOM.node" {
.{ "link.normalize()", "undefined" },
}, .{});
try runner.testCases(&.{
.{ "link.baseURI", "https://lightpanda.io/opensource-browser/" },
}, .{});
try runner.testCases(&.{
.{ "content.removeChild(append) !== undefined", "true" },
.{ "last_child.__proto__.constructor.name !== 'HTMLHeadingElement'", "true" },