mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Join tokens when stringifying DOMTokenList
Previous, it would return the original String straight from the AttrValue, which might contain extraaneous whitespace. The spec specifies to just join the tokens together with \x20 https://dom.spec.whatwg.org/#stringification-behavior
This commit is contained in:
parent
9b2ba3d713
commit
91b0671e1d
3 changed files with 6 additions and 9 deletions
|
@ -157,6 +157,11 @@ impl<'a> DOMTokenListMethods for &'a DOMTokenList {
|
||||||
|
|
||||||
// https://dom.spec.whatwg.org/#stringification-behavior
|
// https://dom.spec.whatwg.org/#stringification-behavior
|
||||||
fn Stringifier(self) -> DOMString {
|
fn Stringifier(self) -> DOMString {
|
||||||
self.element.root().r().get_string_attribute(&self.local_name)
|
let tokenlist = self.element.root().r().get_tokenlist_attribute(&self.local_name);
|
||||||
|
tokenlist.iter().fold(String::new(), |mut s, atom| {
|
||||||
|
if !s.is_empty() { s.push('\x20'); }
|
||||||
|
s.push_str(atom);
|
||||||
|
s
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
[DOMTokenList-stringifier.html]
|
|
||||||
type: testharness
|
|
||||||
[DOMTokenList stringifier]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
[empty classList should return the empty string since the ordered set parser skip the whitespaces]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[computed style must update when setting .className]
|
[computed style must update when setting .className]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue