Support links in style= attributes

pull/78/head
Emi Simpson 5 years ago
parent a4743ca92f
commit 45335d7507
No known key found for this signature in database
GPG Key ID: 68FAB2E2E6DFC98B

@ -413,6 +413,7 @@ pub fn walk_and_embed_assets(
_ => {}
}
// Process style attributes
if opt_no_css {
// Get rid of style attributes
let mut style_attr_indexes = Vec::new();
@ -425,6 +426,28 @@ pub fn walk_and_embed_assets(
for attr_index in style_attr_indexes {
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 {

Loading…
Cancel
Save