-
Notifications
You must be signed in to change notification settings - Fork 30
Open
astral-sh/astral-tl
#13Description
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")
Metadata
Metadata
Assignees
Labels
No labels