diff options
author | Ms2ger <ms2ger@gmail.com> | 2014-09-23 22:22:45 +0200 |
---|---|---|
committer | Ms2ger <ms2ger@gmail.com> | 2014-09-23 22:22:45 +0200 |
commit | d3d7c1dabd8b3a0915b6de22780f834b660a3122 (patch) | |
tree | 84db57b876dc879c02dd783edcbc21e7be683771 /components/script/dom/htmlcollection.rs | |
parent | 4546d5d23caa3f459b75e9a0bf9e91a3376dc197 (diff) | |
download | servo-d3d7c1dabd8b3a0915b6de22780f834b660a3122.tar.gz servo-d3d7c1dabd8b3a0915b6de22780f834b660a3122.zip |
Handle null strings in Namespace::new.
This also avoids a string copy in the rare case of an unrecognized namespace.
Diffstat (limited to 'components/script/dom/htmlcollection.rs')
-rw-r--r-- | components/script/dom/htmlcollection.rs | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/components/script/dom/htmlcollection.rs b/components/script/dom/htmlcollection.rs index b321d40b4eb..07ea03b1f81 100644 --- a/components/script/dom/htmlcollection.rs +++ b/components/script/dom/htmlcollection.rs @@ -12,7 +12,6 @@ use dom::element::{Element, AttributeHandlers, ElementHelpers}; use dom::node::{Node, NodeHelpers}; use dom::window::Window; use servo_util::atom::Atom; -use servo_util::namespace; use servo_util::namespace::Namespace; use servo_util::str::{DOMString, split_html_space_chars}; @@ -109,13 +108,8 @@ impl HTMLCollection { pub fn by_tag_name_ns(window: JSRef<Window>, root: JSRef<Node>, tag: DOMString, maybe_ns: Option<DOMString>) -> Temporary<HTMLCollection> { let namespace_filter = match maybe_ns { - Some(namespace) => { - match namespace.as_slice() { - "*" => None, - ns => Some(Namespace::from_str(ns)), - } - }, - None => Some(namespace::Null), + Some(ref namespace) if namespace.as_slice() == "*" => None, + ns => Some(Namespace::from_str(ns)), }; if tag.as_slice() == "*" { |