File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,8 @@ const NodeList = @import("nodelist.zig").NodeList;
3131const HTMLElem = @import ("../html/elements.zig" );
3232pub const Union = @import ("../html/elements.zig" ).Union ;
3333
34+ const log = std .log .scoped (.element );
35+
3436// WEB IDL https://dom.spec.whatwg.org/#element
3537pub const Element = struct {
3638 pub const Self = parser .Element ;
@@ -146,16 +148,12 @@ pub const Element = struct {
146148 while (true ) {
147149 if (try select .match (current )) {
148150 if (! current .isElement ()) {
149- std . debug . print ("closest: is not an element: {s}\n " , .{try current .tag ()});
151+ log . err ("closest: is not an element: {s}" , .{try current .tag ()});
150152 return null ;
151153 }
152154 return parser .nodeToElement (current .node );
153155 }
154- if (try current .parent ()) | parent | {
155- current = parent ;
156- continue ;
157- }
158- return null ;
156+ current = try current .parent () orelse return null ;
159157 }
160158 }
161159
You can’t perform that action at this time.
0 commit comments