dom: add HTMLCollection

This commit is contained in:
Pierre Tachoire
2023-10-24 17:12:59 +02:00
parent a238eed065
commit 2e40837f0d
3 changed files with 64 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
const std = @import("std");
const parser = @import("../netsurf.zig");
const jsruntime = @import("jsruntime");
const Element = @import("element.zig").Element;
// WEB IDL https://dom.spec.whatwg.org/#htmlcollection
pub const HTMLCollection = struct {
pub const Self = parser.HTMLCollection;
pub const mem_guarantied = true;
// JS funcs
// --------
pub fn _get_length(self: *parser.HTMLCollection) u32 {
return parser.HTMLCollectionLength(self);
}
pub fn _item(self: *parser.HTMLCollection, index: u32) ?*parser.Element {
return parser.HTMLCollectionItem(self, index);
}
pub fn _namedItem(self: *parser.HTMLCollection, name: []const u8) ?*parser.Element {
return parser.HTMLCollectionNamedItem(self, name);
}
};