Issue #10284 Ignore alternate stylesheets

This commit is contained in:
Hugo Thiessard 2016-03-31 20:17:04 +02:00
parent d1e8b79583
commit c39c7533ca
6 changed files with 5460 additions and 4 deletions

View file

@ -89,8 +89,17 @@ fn get_attr(element: &Element, local_name: &Atom) -> Option<String> {
fn string_is_stylesheet(value: &Option<String>) -> bool { fn string_is_stylesheet(value: &Option<String>) -> bool {
match *value { match *value {
Some(ref value) => { Some(ref value) => {
value.split(HTML_SPACE_CHARACTERS) let mut found_stylesheet = false;
.any(|s| s.eq_ignore_ascii_case("stylesheet")) for s in value.split(HTML_SPACE_CHARACTERS).into_iter() {
if s.eq_ignore_ascii_case("alternate") {
return false;
}
if s.eq_ignore_ascii_case("stylesheet") {
found_stylesheet = true;
}
}
found_stylesheet
}, },
None => false, None => false,
} }

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,6 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Reference of Alternate css</title>
<link rel="match" href="alternate-css-ref.html">
<link rel="stylesheet" href="preferred.css" title="preferred">
<div>foobar</div>

View file

@ -0,0 +1,7 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Alternate css</title>
<link rel="match" href="alternate-css-ref.html">
<link rel="stylesheet" href="preferred.css" title="preferred">
<link rel="alternate stylesheet" href="alternate.css" title="alternate">
<div>foobar</div>

View file

@ -0,0 +1,3 @@
div {
background-color: red;
}

View file

@ -0,0 +1,3 @@
div {
border: 4px solid green;
}