mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-12-16 08:18:59 +00:00
simplify / standardized how HTMLFormControlsCollection 'inherits' from HTMLCollection
This commit is contained in:
@@ -41,7 +41,6 @@ const Mode = enum {
|
|||||||
|
|
||||||
const HTMLCollection = @This();
|
const HTMLCollection = @This();
|
||||||
|
|
||||||
_type: Type = .{ .generic = {} },
|
|
||||||
_data: union(Mode) {
|
_data: union(Mode) {
|
||||||
tag: NodeLive(.tag),
|
tag: NodeLive(.tag),
|
||||||
tag_name: NodeLive(.tag_name),
|
tag_name: NodeLive(.tag_name),
|
||||||
@@ -56,11 +55,6 @@ _data: union(Mode) {
|
|||||||
form: NodeLive(.form),
|
form: NodeLive(.form),
|
||||||
},
|
},
|
||||||
|
|
||||||
const Type = union(enum) {
|
|
||||||
generic: void,
|
|
||||||
form: *Form,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub fn length(self: *HTMLCollection, page: *const Page) u32 {
|
pub fn length(self: *HTMLCollection, page: *const Page) u32 {
|
||||||
return switch (self._data) {
|
return switch (self._data) {
|
||||||
inline else => |*impl| impl.length(page),
|
inline else => |*impl| impl.length(page),
|
||||||
|
|||||||
@@ -328,7 +328,7 @@ pub fn NodeLive(comptime mode: Mode) type {
|
|||||||
.selected_options => HTMLCollection{ ._data = .{ .selected_options = self } },
|
.selected_options => HTMLCollection{ ._data = .{ .selected_options = self } },
|
||||||
.links => HTMLCollection{ ._data = .{ .links = self } },
|
.links => HTMLCollection{ ._data = .{ .links = self } },
|
||||||
.anchors => HTMLCollection{ ._data = .{ .anchors = 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);
|
return page._factory.create(collection);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user