diff options
author | Simon Sapin <simon.sapin@exyr.org> | 2014-01-25 08:22:51 -0800 |
---|---|---|
committer | Simon Sapin <simon.sapin@exyr.org> | 2014-01-25 12:14:06 -0800 |
commit | 624e2714d44d6d064aa507f8f6c806888a0f8ddc (patch) | |
tree | 23690076464d8062bb2d23695dd966fda3214c21 /src/components/script/dom/namespace.rs | |
parent | ae0cbda327b16e4f38b10e1913b04c3eaad0224e (diff) | |
download | servo-624e2714d44d6d064aa507f8f6c806888a0f8ddc.tar.gz servo-624e2714d44d6d064aa507f8f6c806888a0f8ddc.zip |
Move script::dom::namespace into util, in order to use it from style later.
Diffstat (limited to 'src/components/script/dom/namespace.rs')
-rw-r--r-- | src/components/script/dom/namespace.rs | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/src/components/script/dom/namespace.rs b/src/components/script/dom/namespace.rs deleted file mode 100644 index 354f95f69b2..00000000000 --- a/src/components/script/dom/namespace.rs +++ /dev/null @@ -1,43 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#[deriving(Eq, Clone)] -pub enum Namespace { - Null, - HTML, - XML, - XMLNS, - XLink, - SVG, - MathML, - Other(~str) -} - -impl Namespace { - /// Empty string for "no namespace" - pub fn from_str(url: &str) -> Namespace { - match url { - "http://www.w3.org/1999/xhtml" => HTML, - "http://www.w3.org/XML/1998/namespace" => XML, - "http://www.w3.org/2000/xmlns/" => XMLNS, - "http://www.w3.org/1999/xlink" => XLink, - "http://www.w3.org/2000/svg" => SVG, - "http://www.w3.org/1998/Math/MathML" => MathML, - "" => Null, - ns => Other(ns.to_owned()) - } - } - pub fn to_str<'a>(&'a self) -> Option<&'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()) - } - } -} |