diff --git a/src/components/script/dom/attr.rs b/src/components/script/dom/attr.rs index e7e13853087..9ecf068774e 100644 --- a/src/components/script/dom/attr.rs +++ b/src/components/script/dom/attr.rs @@ -89,7 +89,10 @@ impl Attr { } pub fn GetNamespaceURI(&self) -> Option { - self.namespace.to_str().map(|s| s.to_owned()) + match self.namespace.to_str() { + "" => None, + url => Some(url.to_owned()), + } } pub fn GetPrefix(&self) -> Option { diff --git a/src/components/util/namespace.rs b/src/components/util/namespace.rs index 354f95f69b2..ff9eda169c9 100644 --- a/src/components/util/namespace.rs +++ b/src/components/util/namespace.rs @@ -28,16 +28,16 @@ impl Namespace { ns => Other(ns.to_owned()) } } - pub fn to_str<'a>(&'a self) -> Option<&'a str> { + pub fn to_str<'a>(&'a self) -> &'a str { match *self { - Null => None, - HTML => Some("http://www.w3.org/1999/xhtml"), - XML => Some("http://www.w3.org/XML/1998/namespace"), - XMLNS => Some("http://www.w3.org/2000/xmlns/"), - XLink => Some("http://www.w3.org/1999/xlink"), - SVG => Some("http://www.w3.org/2000/svg"), - MathML => Some("http://www.w3.org/1998/Math/MathML"), - Other(ref x) => Some(x.as_slice()) + Null => "", + HTML => "http://www.w3.org/1999/xhtml", + XML => "http://www.w3.org/XML/1998/namespace", + XMLNS => "http://www.w3.org/2000/xmlns/", + XLink => "http://www.w3.org/1999/xlink", + SVG => "http://www.w3.org/2000/svg", + MathML => "http://www.w3.org/1998/Math/MathML", + Other(ref x) => x.as_slice() } } }