Lightpanda: the headless browser designed for AI and automation
webapi: Attr.ownerDocument follows the owning element
Francis Bouvier91a2bbcfe377
diff --git a/src/browser/webapi/Node.zig b/src/browser/webapi/Node.zigindex 8544cea0a..1be03fe94 100644--- a/src/browser/webapi/Node.zig+++ b/src/browser/webapi/Node.zig@@ -650,6 +650,14 @@ pub fn ownerDocument(self: *const Node, frame: *const Frame) ?*Document {return null;}+ // An attribute node has no parent; its owner follows its element's+ // (including across adoption into another document).+ if (self._type == .attribute) {+ if (self._type.attribute._element) |element| {+ return element.asNode().ownerDocument(frame);+ }+ }+// The root of the tree that a node belongs to is its owner.var current = self;while (current._parent) |parent| {