simplify / standardized how HTMLFormControlsCollection 'inherits' from HTMLCollection

This commit is contained in:
Karl Seguin
2025-12-15 10:35:41 +08:00
parent ac0601b141
commit 4bebc4c142
2 changed files with 1 additions and 7 deletions

View File

@@ -41,7 +41,6 @@ const Mode = enum {
const HTMLCollection = @This();
_type: Type = .{ .generic = {} },
_data: union(Mode) {
tag: NodeLive(.tag),
tag_name: NodeLive(.tag_name),
@@ -56,11 +55,6 @@ _data: union(Mode) {
form: NodeLive(.form),
},
const Type = union(enum) {
generic: void,
form: *Form,
};
pub fn length(self: *HTMLCollection, page: *const Page) u32 {
return switch (self._data) {
inline else => |*impl| impl.length(page),

View File

@@ -328,7 +328,7 @@ pub fn NodeLive(comptime mode: Mode) type {
.selected_options => HTMLCollection{ ._data = .{ .selected_options = self } },
.links => HTMLCollection{ ._data = .{ .links = self } },
.anchors => HTMLCollection{ ._data = .{ .anchors = self } },
.form => HTMLCollection{ ._type = .{ .form = self._filter }, ._data = .{ .form = self } },
.form => HTMLCollection{ ._data = .{ .form = self } },
};
return page._factory.create(collection);
}