Skip to content

Selector can not capture <tr></tr>. #24

@kenkoooo

Description

@kenkoooo

As the example, the following code works correctly.

use scraper::{Html, Selector};
fn main() {
    let html = r#"
    <ul>
        <li>Foo</li>
        <li>Bar</li>
        <li>Baz</li>
    </ul>
"#;

    let fragment = Html::parse_fragment(html);
    let selector = Selector::parse("ul").unwrap();
    assert!(fragment.select(&selector).next().is_some());
}

Although the following code is almost same as the above one, it doesn't work.

use scraper::{Html, Selector};
fn main() {
    let html = r#"
    <tr>
        <li>Foo</li>
        <li>Bar</li>
        <li>Baz</li>
    </tr>
"#;

    let fragment = Html::parse_fragment(html);
    let selector = Selector::parse("tr").unwrap();
    assert!(fragment.select(&selector).next().is_some());
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions