mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Avoid duplicated tokens in AttrValue::from_serialized_tokenlist
This commit is contained in:
parent
eb3678fa28
commit
c5f7e553e4
2 changed files with 6 additions and 8 deletions
|
@ -38,8 +38,12 @@ pub enum AttrValue {
|
|||
|
||||
impl AttrValue {
|
||||
pub fn from_serialized_tokenlist(tokens: DOMString) -> AttrValue {
|
||||
let atoms = split_html_space_chars(tokens.as_slice())
|
||||
.map(|token| Atom::from_slice(token)).collect();
|
||||
let mut atoms: Vec<Atom> = vec!();
|
||||
for token in split_html_space_chars(tokens.as_slice()).map(|slice| Atom::from_slice(slice)) {
|
||||
if !atoms.iter().any(|atom| *atom == token) {
|
||||
atoms.push(token);
|
||||
}
|
||||
}
|
||||
AttrValue::TokenList(tokens, atoms)
|
||||
}
|
||||
|
||||
|
|
|
@ -3,9 +3,6 @@
|
|||
[CSS .foo selectors must not match elements without any class]
|
||||
expected: FAIL
|
||||
|
||||
[classList must be correct for an element that has classes]
|
||||
expected: FAIL
|
||||
|
||||
[empty classList should return the empty string since the ordered set parser skip the whitespaces]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -63,9 +60,6 @@
|
|||
[classList.remove must not break case-sensitive CSS selector matching]
|
||||
expected: FAIL
|
||||
|
||||
[classList.remove must remove duplicated tokens]
|
||||
expected: FAIL
|
||||
|
||||
[classList.remove must collapse whitespace around removed tokens]
|
||||
expected: FAIL
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue