Merge pull request #250 from snshn/alternate-stylesheets

Embed alternate stylesheets
pull/251/head
Sunshine 3 years ago committed by GitHub
commit be097b1d4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -545,7 +545,9 @@ pub fn walk_and_embed_assets(
if let Some(link_attr_rel_value) = get_node_attr(node, "rel") {
if is_icon(&link_attr_rel_value) {
link_type = LinkType::Icon;
} else if link_attr_rel_value.eq_ignore_ascii_case("stylesheet") {
} else if link_attr_rel_value.eq_ignore_ascii_case("stylesheet")
|| link_attr_rel_value.eq_ignore_ascii_case("alternate stylesheet")
{
link_type = LinkType::Stylesheet;
} else if link_attr_rel_value.eq_ignore_ascii_case("preload") {
link_type = LinkType::Preload;

@ -87,6 +87,7 @@ mod passing {
#[test]
fn no_css() {
let html = "<link rel=\"stylesheet\" href=\"main.css\">\
<link rel=\"alternate stylesheet\" href=\"main.css\">\
<style>html{background-color: #000;}</style>\
<div style=\"display: none;\"></div>";
let dom = html::html_to_dom(&html);
@ -109,6 +110,7 @@ mod passing {
"<html>\
<head>\
<link rel=\"stylesheet\">\
<link rel=\"alternate stylesheet\">\
<style></style>\
</head>\
<body>\

Loading…
Cancel
Save