mirror of
https://github.com/servo/servo.git
synced 2025-10-08 12:39:30 +01:00
Implement Element.matches().
This commit is contained in:
parent
0974d21bcd
commit
b6edd5318f
4 changed files with 51 additions and 0 deletions
|
@ -451,6 +451,7 @@ pub trait ElementMethods {
|
|||
fn QuerySelector(&self, selectors: DOMString) -> Fallible<Option<Temporary<Element>>>;
|
||||
fn QuerySelectorAll(&self, selectors: DOMString) -> Fallible<Temporary<NodeList>>;
|
||||
fn Remove(&self);
|
||||
fn Matches(&self, selectors: DOMString) -> Fallible<bool>;
|
||||
}
|
||||
|
||||
impl<'a> ElementMethods for JSRef<'a, Element> {
|
||||
|
@ -757,6 +758,12 @@ impl<'a> ElementMethods for JSRef<'a, Element> {
|
|||
let node: &JSRef<Node> = NodeCast::from_ref(self);
|
||||
node.remove_self();
|
||||
}
|
||||
|
||||
// http://dom.spec.whatwg.org/#dom-element-matches
|
||||
fn Matches(&self, selectors: DOMString) -> Fallible<bool> {
|
||||
let root: &JSRef<Node> = NodeCast::from_ref(self);
|
||||
root.matches(selectors)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_attribute_parts(name: DOMString) -> (Option<String>, String) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue