mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +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)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue