diff options
author | bors-servo <metajack+bors@gmail.com> | 2015-07-07 08:58:35 -0600 |
---|---|---|
committer | bors-servo <metajack+bors@gmail.com> | 2015-07-07 08:58:35 -0600 |
commit | d64f91863af6c22b3af6d5ea5ebfd671f4e83aaa (patch) | |
tree | 5b151f9c95b17e9fcbd7d1066b7c7f467322f7d8 /components/script/dom | |
parent | 0688488a7fd3caee423968b33d6c19d79f94d29a (diff) | |
parent | 7159fe749f59931d09cedcffcb3d2ff52432cbcc (diff) | |
download | servo-d64f91863af6c22b3af6d5ea5ebfd671f4e83aaa.tar.gz servo-d64f91863af6c22b3af6d5ea5ebfd671f4e83aaa.zip |
Auto merge of #6555 - frewsxcv:stringify-tokenlist, r=Ms2ger
Join tokens when stringifying DOMTokenList
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6555)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom')
-rw-r--r-- | components/script/dom/attr.rs | 4 | ||||
-rw-r--r-- | components/script/dom/domtokenlist.rs | 5 |
2 files changed, 5 insertions, 4 deletions
diff --git a/components/script/dom/attr.rs b/components/script/dom/attr.rs index 0c8e92f7d42..782ab3fd884 100644 --- a/components/script/dom/attr.rs +++ b/components/script/dom/attr.rs @@ -14,7 +14,7 @@ use dom::window::Window; use dom::virtualmethods::vtable_for; use devtools_traits::AttrInfo; -use util::str::{DOMString, parse_unsigned_integer, split_html_space_chars}; +use util::str::{DOMString, parse_unsigned_integer, split_html_space_chars, str_join}; use string_cache::{Atom, Namespace}; @@ -49,7 +49,7 @@ impl AttrValue { } pub fn from_atomic_tokens(atoms: Vec<Atom>) -> AttrValue { - let tokens = atoms.iter().map(|x| &**x).collect::<Vec<_>>().connect("\x20"); + let tokens = str_join(&atoms, "\x20"); AttrValue::TokenList(tokens, atoms) } diff --git a/components/script/dom/domtokenlist.rs b/components/script/dom/domtokenlist.rs index b3656ae4b7c..f7a02cdf572 100644 --- a/components/script/dom/domtokenlist.rs +++ b/components/script/dom/domtokenlist.rs @@ -13,7 +13,7 @@ use dom::bindings::utils::{Reflector, reflect_dom_object}; use dom::element::{Element, AttributeHandlers}; use dom::node::window_from_node; -use util::str::{DOMString, HTML_SPACE_CHARACTERS}; +use util::str::{DOMString, HTML_SPACE_CHARACTERS, str_join}; use string_cache::Atom; use std::borrow::ToOwned; @@ -157,6 +157,7 @@ impl<'a> DOMTokenListMethods for &'a DOMTokenList { // https://dom.spec.whatwg.org/#stringification-behavior 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); + str_join(&tokenlist, "\x20") } } |