Implement From<DOMString> for Atom

This commit is contained in:
Anthony Ramine 2016-02-24 17:28:24 +01:00
parent f7fb035188
commit 0adfb08089
20 changed files with 44 additions and 38 deletions

View file

@ -1847,7 +1847,7 @@ impl DocumentMethods for Document {
Vacant(entry) => {
let mut tag_copy = tag_name;
tag_copy.make_ascii_lowercase();
let ascii_lower_tag = Atom::from(&*tag_copy);
let ascii_lower_tag = Atom::from(tag_copy);
let result = HTMLCollection::by_atomic_tag_name(&self.window,
self.upcast(),
tag_atom,
@ -1864,7 +1864,7 @@ impl DocumentMethods for Document {
tag_name: DOMString)
-> Root<HTMLCollection> {
let ns = namespace_from_domstring(maybe_ns);
let local = Atom::from(&*tag_name);
let local = Atom::from(tag_name);
let qname = QualName::new(ns, local);
match self.tagns_map.borrow_mut().entry(qname.clone()) {
Occupied(entry) => Root::from_ref(entry.get()),
@ -1895,7 +1895,7 @@ impl DocumentMethods for Document {
// https://dom.spec.whatwg.org/#dom-nonelementparentnode-getelementbyid
fn GetElementById(&self, id: DOMString) -> Option<Root<Element>> {
self.get_element_by_id(&Atom::from(&*id))
self.get_element_by_id(&Atom::from(id))
}
// https://dom.spec.whatwg.org/#dom-document-createelement
@ -1907,7 +1907,7 @@ impl DocumentMethods for Document {
if self.is_html_document {
local_name.make_ascii_lowercase();
}
let name = QualName::new(ns!(html), Atom::from(&*local_name));
let name = QualName::new(ns!(html), Atom::from(local_name));
Ok(Element::create(name, None, self, ElementCreator::ScriptCreated))
}
@ -1931,7 +1931,7 @@ impl DocumentMethods for Document {
if self.is_html_document {
local_name.make_ascii_lowercase();
}
let name = Atom::from(&*local_name);
let name = Atom::from(local_name);
let value = AttrValue::String(DOMString::new());
Ok(Attr::new(&self.window, name.clone(), value, name, ns!(), None, None))
@ -1945,7 +1945,7 @@ impl DocumentMethods for Document {
let (namespace, prefix, local_name) = try!(validate_and_extract(namespace,
&qualified_name));
let value = AttrValue::String(DOMString::new());
let qualified_name = Atom::from(&*qualified_name);
let qualified_name = Atom::from(qualified_name);
Ok(Attr::new(&self.window,
local_name,
value,
@ -2491,7 +2491,7 @@ impl DocumentMethods for Document {
_ => false,
}
}
let name = Atom::from(&*name);
let name = Atom::from(name);
let root = self.upcast::<Node>();
{
// Step 1.