mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +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 {
|
impl AttrValue {
|
||||||
pub fn from_serialized_tokenlist(tokens: DOMString) -> AttrValue {
|
pub fn from_serialized_tokenlist(tokens: DOMString) -> AttrValue {
|
||||||
let atoms = split_html_space_chars(tokens.as_slice())
|
let mut atoms: Vec<Atom> = vec!();
|
||||||
.map(|token| Atom::from_slice(token)).collect();
|
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)
|
AttrValue::TokenList(tokens, atoms)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,6 @@
|
||||||
[CSS .foo selectors must not match elements without any class]
|
[CSS .foo selectors must not match elements without any class]
|
||||||
expected: FAIL
|
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]
|
[empty classList should return the empty string since the ordered set parser skip the whitespaces]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
@ -63,9 +60,6 @@
|
||||||
[classList.remove must not break case-sensitive CSS selector matching]
|
[classList.remove must not break case-sensitive CSS selector matching]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[classList.remove must remove duplicated tokens]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[classList.remove must collapse whitespace around removed tokens]
|
[classList.remove must collapse whitespace around removed tokens]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue