use a better comparison to detect comment

This commit is contained in:
Pierre Tachoire
2025-12-07 09:52:59 +01:00
parent a673eb89b6
commit 240e8b3502

View File

@@ -175,12 +175,8 @@ pub fn getTextContent(self: *Node, writer: *std.Io.Writer) error{WriteFailed}!vo
var it = self.childrenIterator(); var it = self.childrenIterator();
while (it.next()) |child| { while (it.next()) |child| {
// ignore comments and TODO processing instructions. // ignore comments and TODO processing instructions.
switch (child._type) { if (child.is(CData.Comment) != null) {
.cdata => |c| switch (c._type) { continue;
.comment => continue,
.text => {},
},
else => {},
} }
try child.getTextContent(writer); try child.getTextContent(writer);
} }