-
Notifications
You must be signed in to change notification settings - Fork 30
Open
Description
I encountered an issue where parsing breaks after a comment ending in ---> instead of the usual -->:
use tl::{parse, ParserOptions};
fn main() {
let dom = parse(r#"
<div class="ok"></div>
<!-- Comment with extra hyphen >--->
<div class="unreachable"></div>
"#, ParserOptions::default()).unwrap();
dom.get_elements_by_class_name("ok").next().expect(".ok node");
dom.get_elements_by_class_name("unreachable").next().expect(".unreachable node");
}Printing the DOM:
VDom {
parser: Parser {
stream: Stream { ... },
stack: [],
options: ParserOptions {
flags: 0,
},
tags: [
Raw(
Bytes(
"\n ",
),
),
Tag(
HTMLTag {
_name: Bytes(
"div",
),
_attributes: Attributes {
raw: InlineHashMap(
InlineHashMap<0 items>,
),
id: None,
class: Some(
Bytes(
"ok",
),
),
},
_children: InlineVec(
InlineVec<0 items>,
),
_raw: Bytes(
"<div class=\"ok\"></div>",
),
},
),
Raw(
Bytes(
"\n ",
),
),
Comment(
Bytes(
"",
),
),
],
ast: [
NodeHandle(
0,
),
NodeHandle(
1,
),
NodeHandle(
2,
),
NodeHandle(
3,
),
],
ids: {},
classes: {},
version: None,
},
}The last node is the comment, and it's parsed as if it's empty. Removing the extra dash produces the expected result
Metadata
Metadata
Assignees
Labels
No labels