Skip to content

Commit 0998ae7

Browse files
committed
use log an brievity
1 parent dd7e6d3 commit 0998ae7

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/browser/dom/element.zig

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ const NodeList = @import("nodelist.zig").NodeList;
3131
const HTMLElem = @import("../html/elements.zig");
3232
pub 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
3537
pub 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

0 commit comments

Comments
 (0)