From 11207d49d21117cf681205e5fa527d0546c85c3b Mon Sep 17 00:00:00 2001 From: Sunshine Date: Tue, 9 Mar 2021 01:46:15 -1000 Subject: [PATCH 1/2] embed alternate stylesheets --- src/html.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/html.rs b/src/html.rs index b8a7b04..7449d0d 100644 --- a/src/html.rs +++ b/src/html.rs @@ -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; From 325688acf5a3ede0e3f741672ef6aedc6f3f224d Mon Sep 17 00:00:00 2001 From: Sunshine Date: Tue, 9 Mar 2021 01:48:41 -1000 Subject: [PATCH 2/2] add test for alternate stylesheets --- src/tests/html/walk_and_embed_assets.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/tests/html/walk_and_embed_assets.rs b/src/tests/html/walk_and_embed_assets.rs index 93026d1..d16b438 100644 --- a/src/tests/html/walk_and_embed_assets.rs +++ b/src/tests/html/walk_and_embed_assets.rs @@ -87,6 +87,7 @@ mod passing { #[test] fn no_css() { let html = "\ + \ \
"; let dom = html::html_to_dom(&html); @@ -109,6 +110,7 @@ mod passing { "\ \ \ + \ \ \ \