mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Merge pull request #3465 from Ms2ger/ns
Handle null strings in Namespace::new.
This commit is contained in:
commit
c7a575e793
5 changed files with 21 additions and 24 deletions
|
@ -57,7 +57,7 @@ use layout_interface::{DocumentDamageLevel, ContentChangedDocumentDamage};
|
|||
use servo_util::atom::Atom;
|
||||
use servo_util::namespace;
|
||||
use servo_util::namespace::{Namespace, Null};
|
||||
use servo_util::str::{DOMString, null_str_as_empty_ref, split_html_space_chars};
|
||||
use servo_util::str::{DOMString, split_html_space_chars};
|
||||
|
||||
use std::collections::hashmap::HashMap;
|
||||
use std::ascii::StrAsciiExt;
|
||||
|
@ -464,7 +464,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
|||
fn CreateElementNS(self,
|
||||
namespace: Option<DOMString>,
|
||||
qualified_name: DOMString) -> Fallible<Temporary<Element>> {
|
||||
let ns = Namespace::from_str(null_str_as_empty_ref(&namespace));
|
||||
let ns = Namespace::from_str(namespace);
|
||||
match xml_name_type(qualified_name.as_slice()) {
|
||||
InvalidXMLName => {
|
||||
debug!("Not a valid element name");
|
||||
|
|
|
@ -37,7 +37,7 @@ use style;
|
|||
use servo_util::atom::Atom;
|
||||
use servo_util::namespace;
|
||||
use servo_util::namespace::{Namespace, Null};
|
||||
use servo_util::str::{DOMString, null_str_as_empty_ref};
|
||||
use servo_util::str::DOMString;
|
||||
|
||||
use std::ascii::StrAsciiExt;
|
||||
use std::cell::{Cell, RefCell};
|
||||
|
@ -599,7 +599,7 @@ impl<'a> ElementMethods for JSRef<'a, Element> {
|
|||
fn GetAttributeNS(self,
|
||||
namespace: Option<DOMString>,
|
||||
local_name: DOMString) -> Option<DOMString> {
|
||||
let namespace = Namespace::from_str(null_str_as_empty_ref(&namespace));
|
||||
let namespace = Namespace::from_str(namespace);
|
||||
self.get_attribute(namespace, local_name.as_slice()).root()
|
||||
.map(|attr| attr.deref().Value())
|
||||
}
|
||||
|
@ -646,7 +646,7 @@ impl<'a> ElementMethods for JSRef<'a, Element> {
|
|||
}
|
||||
|
||||
// Step 1.
|
||||
let namespace = Namespace::from_str(null_str_as_empty_ref(&namespace_url));
|
||||
let namespace = Namespace::from_str(namespace_url);
|
||||
|
||||
let name_type = xml_name_type(name.as_slice());
|
||||
match name_type {
|
||||
|
@ -718,7 +718,7 @@ impl<'a> ElementMethods for JSRef<'a, Element> {
|
|||
fn RemoveAttributeNS(self,
|
||||
namespace: Option<DOMString>,
|
||||
localname: DOMString) {
|
||||
let namespace = Namespace::from_str(null_str_as_empty_ref(&namespace));
|
||||
let namespace = Namespace::from_str(namespace);
|
||||
self.remove_attribute(namespace, localname.as_slice())
|
||||
}
|
||||
|
||||
|
|
|
@ -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() == "*" {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue