mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Make Namespace::to_str() return a string.
This commit is contained in:
parent
e9ece24de9
commit
5ae7aad6e2
2 changed files with 13 additions and 10 deletions
|
@ -89,7 +89,10 @@ impl Attr {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn GetNamespaceURI(&self) -> Option<DOMString> {
|
pub fn GetNamespaceURI(&self) -> Option<DOMString> {
|
||||||
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<DOMString> {
|
pub fn GetPrefix(&self) -> Option<DOMString> {
|
||||||
|
|
|
@ -28,16 +28,16 @@ impl Namespace {
|
||||||
ns => Other(ns.to_owned())
|
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 {
|
match *self {
|
||||||
Null => None,
|
Null => "",
|
||||||
HTML => Some("http://www.w3.org/1999/xhtml"),
|
HTML => "http://www.w3.org/1999/xhtml",
|
||||||
XML => Some("http://www.w3.org/XML/1998/namespace"),
|
XML => "http://www.w3.org/XML/1998/namespace",
|
||||||
XMLNS => Some("http://www.w3.org/2000/xmlns/"),
|
XMLNS => "http://www.w3.org/2000/xmlns/",
|
||||||
XLink => Some("http://www.w3.org/1999/xlink"),
|
XLink => "http://www.w3.org/1999/xlink",
|
||||||
SVG => Some("http://www.w3.org/2000/svg"),
|
SVG => "http://www.w3.org/2000/svg",
|
||||||
MathML => Some("http://www.w3.org/1998/Math/MathML"),
|
MathML => "http://www.w3.org/1998/Math/MathML",
|
||||||
Other(ref x) => Some(x.as_slice())
|
Other(ref x) => x.as_slice()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue