node-html-parser 0.1.1

Fast HTML parser for Rust & WASM producing a lightweight DOM with CSS selector querying.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use node_html_parser::{parse_with_options, valid, Options};

#[test]
fn issue_294_closing_tag_missing_parses_and_valid() {
    let content = "<body><main class=h-entry><p>hello</main></body>";
    // validator should consider this valid (JS parity)
    assert!(valid(content, &Options::default()));
    let root = parse_with_options(content, &Options::default());
    assert_eq!(root.to_string(), "<body><main class=h-entry><p>hello</p></main></body>");
    let list = root.query_selector_all(".h-entry");
    assert_eq!(list.len(), 1);
}