HTML self-closing tags are getting parsed incorrectly (#63)
This commit is contained in:
@@ -619,7 +619,7 @@ pub fn parse_matrix_html(s: &str) -> StyleTree {
|
|||||||
let dom = parse_fragment(
|
let dom = parse_fragment(
|
||||||
RcDom::default(),
|
RcDom::default(),
|
||||||
ParseOpts::default(),
|
ParseOpts::default(),
|
||||||
QualName::new(None, ns!(), local_name!("div")),
|
QualName::new(None, ns!(html), local_name!("body")),
|
||||||
vec![],
|
vec![],
|
||||||
)
|
)
|
||||||
.one(StrTendril::from(s));
|
.one(StrTendril::from(s));
|
||||||
@@ -1147,4 +1147,15 @@ pub mod tests {
|
|||||||
])
|
])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_self_closing() {
|
||||||
|
let s = "Hello<br>World<br>Goodbye";
|
||||||
|
let tree = parse_matrix_html(s);
|
||||||
|
let text = tree.to_text(7, Style::default(), true);
|
||||||
|
assert_eq!(text.lines.len(), 3);
|
||||||
|
assert_eq!(text.lines[0], Spans(vec![Span::raw("Hello"), Span::raw(" "),]));
|
||||||
|
assert_eq!(text.lines[1], Spans(vec![Span::raw("World"), Span::raw(" "),]));
|
||||||
|
assert_eq!(text.lines[2], Spans(vec![Span::raw("Goodbye")]),);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user