Skip to content

Commit 936cd2f

Browse files
committed
fix handling of comments for certain elements
closes #97
1 parent f7e1d10 commit 936cd2f

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/html/Element.zig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,7 @@ pub inline fn validateContent(
345345
switch (child.kind) {
346346
else => {},
347347
.doctype => continue,
348+
.comment => continue,
348349
.text => {
349350
if (!parent.model.content.flow and
350351
!parent.model.content.phrasing and
@@ -401,7 +402,7 @@ pub inline fn validateContent(
401402
.reason = rejection.reason,
402403
},
403404
},
404-
.main_location = child.startTagIterator(src, .html).name_span,
405+
.main_location = child.span(src),
405406
.node_idx = child_idx,
406407
});
407408
}

src/html/elements/html.zig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ pub fn validateContent(
5050
while (child_idx != 0) {
5151
const child = nodes[child_idx];
5252
defer child_idx = child.next_idx;
53+
if (child.kind == .comment) continue;
5354

5455
const child_span = child.span(src);
5556

0 commit comments

Comments
 (0)