Support links in style= attributes
This commit is contained in:
parent
a4743ca92f
commit
45335d7507
1 changed files with 23 additions and 0 deletions
23
src/html.rs
23
src/html.rs
|
@ -413,6 +413,7 @@ pub fn walk_and_embed_assets(
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Process style attributes
|
||||||
if opt_no_css {
|
if opt_no_css {
|
||||||
// Get rid of style attributes
|
// Get rid of style attributes
|
||||||
let mut style_attr_indexes = Vec::new();
|
let mut style_attr_indexes = Vec::new();
|
||||||
|
@ -425,6 +426,28 @@ pub fn walk_and_embed_assets(
|
||||||
for attr_index in style_attr_indexes {
|
for attr_index in style_attr_indexes {
|
||||||
attrs_mut.remove(attr_index);
|
attrs_mut.remove(attr_index);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// Otherwise, parse any links found in the attributes
|
||||||
|
for attribute in attrs_mut
|
||||||
|
.iter_mut()
|
||||||
|
.filter(|a| a.name.local.as_ref().eq_ignore_ascii_case("style"))
|
||||||
|
{
|
||||||
|
let replacement = resolve_css_imports(
|
||||||
|
cache,
|
||||||
|
attribute.value.as_ref(),
|
||||||
|
false,
|
||||||
|
&url,
|
||||||
|
opt_no_images,
|
||||||
|
opt_user_agent,
|
||||||
|
opt_silent,
|
||||||
|
opt_insecure,
|
||||||
|
);
|
||||||
|
attribute.value.clear();
|
||||||
|
attribute
|
||||||
|
.value
|
||||||
|
.write_str(&replacement)
|
||||||
|
.expect("Failed to update DOM");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if opt_no_js {
|
if opt_no_js {
|
||||||
|
|
Loading…
Reference in a new issue