From 4bada6d3dfe15c5d33985c71356dad7a24673d91 Mon Sep 17 00:00:00 2001 From: Karl Seguin Date: Thu, 24 Sep 2026 07:10:43 +0800 Subject: [PATCH] Batch option creation --- src/browser/js/bridge.zig | 8 +++++++ src/browser/tests/element/html/select.html | 19 +++++++++++++++++ .../collections/HTMLOptionsCollection.zig | 21 ++++++++++++++----- 3 files changed, 43 insertions(+), 5 deletions(-) diff --git a/src/browser/js/bridge.zig b/src/browser/js/bridge.zig index 099e57d02..df82f400f 100644 --- a/src/browser/js/bridge.zig +++ b/src/browser/js/bridge.zig @@ -443,6 +443,14 @@ fn GetterQuery(comptime getter: anytype, comptime attrs: u32) type { const params = @typeInfo(@TypeOf(getter)).@"fn".params; const Self = params[0].type.?; const Index = params[1].type.?; + + // A getter that can return neither null nor error.NotHandled would report + // every index as present. + switch (@typeInfo(@typeInfo(@TypeOf(getter)).@"fn".return_type.?)) { + .optional, .error_union => {}, + else => @compileError(@typeName(Self) ++ ": an indexed getter that can't return null or error.NotHandled needs an explicit query"), + } + return struct { const query = if (params.len == 3) withGlobal else plain; diff --git a/src/browser/tests/element/html/select.html b/src/browser/tests/element/html/select.html index 811a48350..c6f378158 100644 --- a/src/browser/tests/element/html/select.html +++ b/src/browser/tests/element/html/select.html @@ -313,6 +313,25 @@ } + +