Skip to content

Select inside <noscript> #123

Open
Open
@pitdicker

Description

@pitdicker

Elements within a <noscript> tag seem to be ignored by default. Is there a workaround?

Example

use scraper::{Html, Selector};

fn main() {
    let fragment = Html::parse_fragment("<noscript><h1>Hello, world!</h1></noscript>");
    let selector = Selector::parse("h1").unwrap();

    let h1 = fragment.select(&selector).next().unwrap();

    assert_eq!("<h1>Hello, world!</h1>", h1.html());
}

current output:

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/main.rs:7:48
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions