css: matcher draft

This commit is contained in:
Pierre Tachoire
2024-03-15 16:09:16 +01:00
parent a131e96ed5
commit b59fd9b1fb
4 changed files with 121 additions and 0 deletions

View File

@@ -165,6 +165,13 @@ pub const Selector = union(enum) {
},
pseudo_element: PseudoClass,
pub fn match(s: Selector, n: anytype) !bool {
return switch (s) {
.tag => |v| std.ascii.eqlIgnoreCase(v, try n.tag()),
else => false,
};
}
pub fn deinit(sel: Selector, alloc: std.mem.Allocator) void {
switch (sel) {
.group => |v| {