Upgrade rust-selectors, pass ':empty' tests

https://github.com/servo/rust-selectors/pull/36
This commit is contained in:
Corey Farwell 2015-07-13 09:10:50 +09:00
parent 406be7accf
commit b1b03a32db
10 changed files with 110 additions and 10 deletions

View file

@ -2579,7 +2579,9 @@ impl<'a> VirtualMethods for &'a Node {
}
}
impl<'a> ::selectors::Node<&'a Element> for &'a Node {
impl<'a> ::selectors::Node for &'a Node {
type Element = &'a Element;
fn parent_node(&self) -> Option<&'a Node> {
(*self).parent_node.get()
.map(|node| node.root().get_unsound_ref_forever())
@ -2609,9 +2611,17 @@ impl<'a> ::selectors::Node<&'a Element> for &'a Node {
DocumentDerived::is_document(*self)
}
fn as_element(&self) -> Option<&'a Element> {
fn as_element(&self) -> Option<Self::Element> {
ElementCast::to_ref(*self)
}
fn is_element_or_non_empty_text(&self) -> bool {
if self.is_text() {
self.GetTextContent().map_or(false, |s| !s.is_empty())
} else {
self.is_element()
}
}
}
pub trait DisabledStateHelpers {