css: check if node is an html element

This commit is contained in:
Pierre Tachoire
2024-03-18 11:36:06 +01:00
parent 7839f466ea
commit 4629e8a9eb
3 changed files with 10 additions and 1 deletions

View File

@@ -20,6 +20,11 @@ pub const Node = struct {
return null;
}
pub fn isElement(n: Node) bool {
const t = parser.nodeType(n.node) catch return false;
return t == .element;
}
pub fn tag(n: Node) ![]const u8 {
return try parser.nodeName(n.node);
}