ID and class selectors are ASCII case-insensitive in quirks mode.

https://bugzilla.mozilla.org/show_bug.cgi?id=1363778
This commit is contained in:
Simon Sapin 2017-06-07 19:07:07 +02:00
parent 524fcac191
commit 5bccf98aa4
22 changed files with 313 additions and 191 deletions

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use style::context::QuirksMode;
#[test]
fn smoke_restyle_hints() {
use cssparser::{Parser, ParserInput};
@ -23,6 +25,6 @@ fn smoke_restyle_hints() {
assert_eq!((selectors.0).len(), 1);
let selector = (selectors.0).first().unwrap();
dependencies.note_selector(selector);
dependencies.note_selector(selector, QuirksMode::NoQuirks);
assert_eq!(dependencies.len(), 1);
}

View file

@ -56,7 +56,7 @@ fn get_mock_map(selectors: &[&str]) -> (SelectorMap<Rule>, SharedRwLock) {
for rules in selector_rules.into_iter() {
for rule in rules.into_iter() {
map.insert(rule)
map.insert(rule, QuirksMode::NoQuirks)
}
}
@ -217,11 +217,11 @@ fn test_get_local_name() {
fn test_insert() {
let (rules_list, _) = get_mock_rules(&[".intro.foo", "#top"]);
let mut selector_map = SelectorMap::new();
selector_map.insert(rules_list[1][0].clone());
assert_eq!(1, selector_map.id_hash.get(&Atom::from("top")).unwrap()[0].source_order);
selector_map.insert(rules_list[0][0].clone());
assert_eq!(0, selector_map.class_hash.get(&Atom::from("foo")).unwrap()[0].source_order);
assert!(selector_map.class_hash.get(&Atom::from("intro")).is_none());
selector_map.insert(rules_list[1][0].clone(), QuirksMode::NoQuirks);
assert_eq!(1, selector_map.id_hash.get(&Atom::from("top"), QuirksMode::NoQuirks).unwrap()[0].source_order);
selector_map.insert(rules_list[0][0].clone(), QuirksMode::NoQuirks);
assert_eq!(0, selector_map.class_hash.get(&Atom::from("foo"), QuirksMode::NoQuirks).unwrap()[0].source_order);
assert!(selector_map.class_hash.get(&Atom::from("intro"), QuirksMode::NoQuirks).is_none());
}
#[test]