Merge pull request #250 from snshn/alternate-stylesheets
Embed alternate stylesheets
This commit is contained in:
commit
be097b1d4e
2 changed files with 5 additions and 1 deletions
|
@ -545,7 +545,9 @@ pub fn walk_and_embed_assets(
|
||||||
if let Some(link_attr_rel_value) = get_node_attr(node, "rel") {
|
if let Some(link_attr_rel_value) = get_node_attr(node, "rel") {
|
||||||
if is_icon(&link_attr_rel_value) {
|
if is_icon(&link_attr_rel_value) {
|
||||||
link_type = LinkType::Icon;
|
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;
|
link_type = LinkType::Stylesheet;
|
||||||
} else if link_attr_rel_value.eq_ignore_ascii_case("preload") {
|
} else if link_attr_rel_value.eq_ignore_ascii_case("preload") {
|
||||||
link_type = LinkType::Preload;
|
link_type = LinkType::Preload;
|
||||||
|
|
|
@ -87,6 +87,7 @@ mod passing {
|
||||||
#[test]
|
#[test]
|
||||||
fn no_css() {
|
fn no_css() {
|
||||||
let html = "<link rel=\"stylesheet\" href=\"main.css\">\
|
let html = "<link rel=\"stylesheet\" href=\"main.css\">\
|
||||||
|
<link rel=\"alternate stylesheet\" href=\"main.css\">\
|
||||||
<style>html{background-color: #000;}</style>\
|
<style>html{background-color: #000;}</style>\
|
||||||
<div style=\"display: none;\"></div>";
|
<div style=\"display: none;\"></div>";
|
||||||
let dom = html::html_to_dom(&html);
|
let dom = html::html_to_dom(&html);
|
||||||
|
@ -109,6 +110,7 @@ mod passing {
|
||||||
"<html>\
|
"<html>\
|
||||||
<head>\
|
<head>\
|
||||||
<link rel=\"stylesheet\">\
|
<link rel=\"stylesheet\">\
|
||||||
|
<link rel=\"alternate stylesheet\">\
|
||||||
<style></style>\
|
<style></style>\
|
||||||
</head>\
|
</head>\
|
||||||
<body>\
|
<body>\
|
||||||
|
|
Loading…
Reference in a new issue