aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/document.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/document.rs')
-rw-r--r--components/script/dom/document.rs19
1 files changed, 9 insertions, 10 deletions
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index a66ec400e34..b3261f6df39 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -56,7 +56,6 @@ use html::hubbub_html_parser::build_element_from_tag;
use hubbub::hubbub::{QuirksMode, NoQuirks, LimitedQuirks, FullQuirks};
use layout_interface::{DocumentDamageLevel, ContentChangedDocumentDamage};
use servo_util::namespace;
-use servo_util::namespace::{Namespace, Null};
use servo_util::str::{DOMString, split_html_space_chars};
use string_cache::Atom;
@@ -466,14 +465,14 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
return Err(InvalidCharacter);
}
let local_name = local_name.as_slice().to_ascii_lower();
- Ok(build_element_from_tag(local_name, namespace::HTML, self))
+ Ok(build_element_from_tag(local_name, ns!(HTML), self))
}
// http://dom.spec.whatwg.org/#dom-document-createelementns
fn CreateElementNS(self,
namespace: Option<DOMString>,
qualified_name: DOMString) -> Fallible<Temporary<Element>> {
- let ns = Namespace::from_str(namespace);
+ let ns = namespace::from_domstring(namespace);
match xml_name_type(qualified_name.as_slice()) {
InvalidXMLName => {
debug!("Not a valid element name");
@@ -490,26 +489,26 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
local_name_from_qname) = get_attribute_parts(qualified_name.as_slice());
match (&ns, prefix_from_qname.clone(), local_name_from_qname.as_slice()) {
// throw if prefix is not null and namespace is null
- (&namespace::Null, Some(_), _) => {
+ (&ns!(""), Some(_), _) => {
debug!("Namespace can't be null with a non-null prefix");
return Err(NamespaceError);
},
// throw if prefix is "xml" and namespace is not the XML namespace
- (_, Some(ref prefix), _) if "xml" == prefix.as_slice() && ns != namespace::XML => {
+ (_, Some(ref prefix), _) if "xml" == prefix.as_slice() && ns != ns!(XML) => {
debug!("Namespace must be the xml namespace if the prefix is 'xml'");
return Err(NamespaceError);
},
// throw if namespace is the XMLNS namespace and neither qualifiedName nor prefix is "xmlns"
- (&namespace::XMLNS, Some(ref prefix), _) if "xmlns" == prefix.as_slice() => {},
- (&namespace::XMLNS, _, "xmlns") => {},
- (&namespace::XMLNS, _, _) => {
+ (&ns!(XMLNS), Some(ref prefix), _) if "xmlns" == prefix.as_slice() => {},
+ (&ns!(XMLNS), _, "xmlns") => {},
+ (&ns!(XMLNS), _, _) => {
debug!("The prefix or the qualified name must be 'xmlns' if namespace is the XMLNS namespace ");
return Err(NamespaceError);
},
_ => {}
}
- if ns == namespace::HTML {
+ if ns == ns!(HTML) {
Ok(build_element_from_tag(local_name_from_qname.to_string(), ns, self))
} else {
Ok(Element::new(local_name_from_qname.to_string(), ns,
@@ -755,7 +754,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
}
let element: JSRef<Element> = ElementCast::to_ref(node).unwrap();
- element.get_attribute(Null, "name").root().map_or(false, |attr| {
+ element.get_attribute(ns!(""), "name").root().map_or(false, |attr| {
attr.value().as_slice() == name.as_slice()
})
})