Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrongly parses attribute if the preceding attribute is valueless #70

Open
EATSTEAK opened this issue Aug 30, 2024 · 0 comments
Open

Wrongly parses attribute if the preceding attribute is valueless #70

EATSTEAK opened this issue Aug 30, 2024 · 0 comments

Comments

@EATSTEAK
Copy link

Tried to parse this fragment:

<input id="id" ct="I" readonly value="82.0">

If you try to parse attributes of this input tag, you will find the first letter of the value attribute is omitted.

try this code:

        let dom = tl::parse(r#"<input id="id" ct="I" readonly value="82.0">"#, tl::ParserOptions::new()).unwrap();
        let parser = dom.parser();
        let element = dom
            .get_element_by_id("id")
            .expect("Failed to find element")
            .get(parser)
            .unwrap()
            .as_tag()
            .unwrap();
        element.attributes().iter().for_each(|(key, value)| { println!(r#"{}: {:?}"#, key, value); });

this results:

ct: Some("I")
readonly: None
alue: Some("82.0")
id: Some("id")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant