Files
craft-anything/crates/js/tests/regression_html_preloads.rs
BFlat 0eea78d7aa Read HTML pages' scripts and preloads correctly in more cases (#645)
Replays #591–#596. The HTML scanner reads rel token lists, decodes asset URLs once, keeps script and title text through lookalike closing tags, and skips raw-text elements, markup inside attribute values and custom tag names.

Co-authored-by: Afloat <132809511+Afloat16@users.noreply.github.com>
2026-11-03 19:58:08 +07:00

10 lines
448 B
Rust

use craft_anything_js::html::scan_html;
#[test]
fn regression_preload_relationships_are_tokens() {
let f = scan_html(
r#"<link rel="alternate PRELOAD" as="SCRIPT" href="one.js"><link rel="stylesheet modulepreload" href="two.js"><link rel="notpreload" as="script" href="no.js"><link rel="preload" as="style" href="no.css"><link rel="preloadish" as="script" href="other.js">"#,
);
assert_eq!(f.preloads, ["one.js", "two.js"]);
}