Skip to content

cannot handle line return inside closing tags #65

@Akronae

Description

@Akronae

With this example:

fn main() -> () {
    let str = r#"<!DOCTYPE html>
    <html>
      <body>
        <div>div 1</div>
        <div>div 2</div
        ><div>div 3</div>
        <div>div 4</div>
      </body>
    </html>
    "#;

    let dom = tl::parse(str, Default::default()).unwrap();
    let parser = dom.parser();
    let inner_html = dom
        .children()
        .get(1)
        .unwrap()
        .get(parser)
        .unwrap()
        .inner_html(parser)
        .to_string();

    dbg!(inner_html);
}
<body>
        <div>div 1</div>
        <div>div 2</div
        ><div>div 3</div>
        <div>div 4</div>
</body>

will be wrongly changed to

 <body>
    <div>div 1</div>
    <div>
        div 2
        <div>div 3</div>
        <div>div 4</div>
    </div>
</body>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions