Update string_cache to 0.2.

Updated string_cache, html5ever, xml5ever and selectors in Cargo.toml files and Cargo.lock.
Removed references to string_cache_plugin.
Import atom! and ns! from string_cache.
Replaced ns!("") by ns!().
Replaced ns!(XML) and co by ns!(xml) and co.
Replaced atom!(foo) by atom!("foo").
Replaced Atom::from_slice by Atom::from.
Replaced atom.as_slice() by &*atom.
This commit is contained in:
Alan Jeffrey 2015-11-24 13:44:59 -06:00
parent e7b1924948
commit 3dec6edd10
68 changed files with 328 additions and 434 deletions

View file

@ -57,25 +57,25 @@ pub fn validate_and_extract(namespace: Option<DOMString>,
debug_assert!(!local_name.contains(colon));
match (namespace, maybe_prefix) {
(ns!(""), Some(_)) => {
(ns!(), Some(_)) => {
// Step 6.
Err(Error::Namespace)
},
(ref ns, Some("xml")) if ns != &ns!(XML) => {
(ref ns, Some("xml")) if ns != &ns!(xml) => {
// Step 7.
Err(Error::Namespace)
},
(ref ns, p) if ns != &ns!(XMLNS) && (qualified_name == "xmlns" || p == Some("xmlns")) => {
(ref ns, p) if ns != &ns!(xmlns) && (qualified_name == "xmlns" || p == Some("xmlns")) => {
// Step 8.
Err(Error::Namespace)
},
(ns!(XMLNS), p) if qualified_name != "xmlns" && p != Some("xmlns") => {
(ns!(xmlns), p) if qualified_name != "xmlns" && p != Some("xmlns") => {
// Step 9.
Err(Error::Namespace)
},
(ns, p) => {
// Step 10.
Ok((ns, p.map(Atom::from_slice), Atom::from_slice(local_name)))
Ok((ns, p.map(Atom::from), Atom::from(local_name)))
}
}
}
@ -171,7 +171,7 @@ pub fn xml_name_type(name: &str) -> XMLName {
/// If the URL is None, returns the empty namespace.
pub fn namespace_from_domstring(url: Option<DOMString>) -> Namespace {
match url {
None => ns!(""),
Some(ref s) => Namespace(Atom::from_slice(s)),
None => ns!(),
Some(s) => Namespace(Atom::from(&*s)),
}
}