mirror of
https://github.com/servo/servo.git
synced 2025-08-02 20:20:14 +01:00
Pass an Atom to Element::create.
This commit is contained in:
parent
e8b02acb1d
commit
9435565f85
4 changed files with 8 additions and 8 deletions
|
@ -76,15 +76,15 @@ use dom::htmlulistelement::HTMLUListElement;
|
|||
use dom::htmlunknownelement::HTMLUnknownElement;
|
||||
use dom::htmlvideoelement::HTMLVideoElement;
|
||||
|
||||
use util::str::DOMString;
|
||||
|
||||
use string_cache::QualName;
|
||||
use string_cache::{Atom, QualName};
|
||||
|
||||
use std::borrow::ToOwned;
|
||||
|
||||
pub fn create_element(name: QualName, prefix: Option<DOMString>,
|
||||
pub fn create_element(name: QualName, prefix: Option<Atom>,
|
||||
document: JSRef<Document>, creator: ElementCreator)
|
||||
-> Temporary<Element> {
|
||||
let prefix = prefix.map(|p| (*p).to_owned());
|
||||
|
||||
if name.ns != ns!(HTML) {
|
||||
return Element::new((*name.local).to_owned(), name.ns, prefix, document);
|
||||
}
|
||||
|
|
|
@ -1025,7 +1025,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
|||
let (namespace, prefix, local_name) =
|
||||
try!(validate_and_extract(namespace, &qualified_name));
|
||||
let name = QualName::new(namespace, local_name);
|
||||
Ok(Element::create(name, prefix.map(|p| (*p).to_owned()), self, ElementCreator::ScriptCreated))
|
||||
Ok(Element::create(name, prefix, self, ElementCreator::ScriptCreated))
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-document-createattribute
|
||||
|
|
|
@ -120,7 +120,7 @@ pub enum ElementCreator {
|
|||
// Element methods
|
||||
//
|
||||
impl Element {
|
||||
pub fn create(name: QualName, prefix: Option<DOMString>,
|
||||
pub fn create(name: QualName, prefix: Option<Atom>,
|
||||
document: JSRef<Document>, creator: ElementCreator)
|
||||
-> Temporary<Element> {
|
||||
create_element(name, prefix, document, creator)
|
||||
|
|
|
@ -70,7 +70,7 @@ use std::iter::{FilterMap, Peekable};
|
|||
use std::mem;
|
||||
use std::sync::Arc;
|
||||
use uuid;
|
||||
use string_cache::QualName;
|
||||
use string_cache::{Atom, QualName};
|
||||
|
||||
//
|
||||
// The basic Node structure
|
||||
|
@ -1735,7 +1735,7 @@ impl Node {
|
|||
local: element.local_name().clone()
|
||||
};
|
||||
let element = Element::create(name,
|
||||
element.prefix().as_ref().map(|p| (**p).to_owned()),
|
||||
element.prefix().as_ref().map(|p| Atom::from_slice(&p)),
|
||||
document.r(), ElementCreator::ScriptCreated);
|
||||
NodeCast::from_temporary(element)
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue