From a18ee895d37609db2af3ce7982f65b1b5d59b1e2 Mon Sep 17 00:00:00 2001 From: Muki Kiboigo Date: Tue, 6 Jan 2026 22:56:10 -0800 Subject: [PATCH] properly handle id with getElementById --- src/browser/webapi/Document.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/browser/webapi/Document.zig b/src/browser/webapi/Document.zig index 6124e23b..7d9fcf28 100644 --- a/src/browser/webapi/Document.zig +++ b/src/browser/webapi/Document.zig @@ -163,8 +163,8 @@ pub fn createAttributeNS(_: *const Document, namespace: []const u8, name: []cons }); } -pub fn getElementById(self: *const Document, id_: ?[]const u8) ?*Element { - const id = id_ orelse return null; +pub fn getElementById(self: *const Document, id: []const u8) ?*Element { + if (id.len == 0) return null; return self._elements_by_id.get(id); }