Replaced DOMString constructor by conversion functions.

Replaced DOMString(...) by DOMString::from(...).
Replaced ....0 by String::from(...).
Removed any uses of .to_owner() in DOMString::from("...").
This commit is contained in:
Alan Jeffrey 2015-11-11 16:26:53 -06:00
parent 736323a779
commit 84bde75b42
64 changed files with 256 additions and 254 deletions

View file

@ -11,7 +11,6 @@ use dom::bindings::js::{JS, Root};
use dom::bindings::reflector::{Reflector, reflect_dom_object};
use dom::element::Element;
use dom::node::window_from_node;
use std::borrow::ToOwned;
use string_cache::Atom;
use util::str::{DOMString, HTML_SPACE_CHARACTERS, str_join};
@ -64,7 +63,8 @@ impl DOMTokenListMethods for DOMTokenList {
// https://dom.spec.whatwg.org/#dom-domtokenlist-item
fn Item(&self, index: u32) -> Option<DOMString> {
self.attribute().and_then(|attr| {
attr.value().as_tokens().get(index as usize).map(|token| DOMString((**token).to_owned()))
// FIXME(ajeffrey): Convert directly from Atom to DOMString
attr.value().as_tokens().get(index as usize).map(|token| DOMString::from(&**token))
})
}
@ -134,7 +134,7 @@ impl DOMTokenListMethods for DOMTokenList {
// https://dom.spec.whatwg.org/#stringification-behavior
fn Stringifier(&self) -> DOMString {
let tokenlist = self.element.get_tokenlist_attribute(&self.local_name);
DOMString(str_join(&tokenlist, "\x20"))
DOMString::from(str_join(&tokenlist, "\x20"))
}
// check-tidy: no specs after this line