Implement support for ParentNode's querySelectorAll

This commit is contained in:
Bruno de Oliveira Abinader 2014-06-10 12:10:44 -04:00
parent b0e8f7cebf
commit 95dcab66b2
4 changed files with 29 additions and 2 deletions

View file

@ -330,6 +330,7 @@ pub trait DocumentMethods {
fn Location(&self) -> Temporary<Location>;
fn Children(&self) -> Temporary<HTMLCollection>;
fn QuerySelector(&self, selectors: DOMString) -> Fallible<Option<Temporary<Element>>>;
fn QuerySelectorAll(&self, selectors: DOMString) -> Fallible<Temporary<NodeList>>;
fn GetOnclick(&self) -> Option<EventHandlerNonNull>;
fn SetOnclick(&mut self, listener: Option<EventHandlerNonNull>);
fn GetOnload(&self) -> Option<EventHandlerNonNull>;
@ -821,6 +822,12 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
root.query_selector(selectors)
}
// http://dom.spec.whatwg.org/#dom-parentnode-queryselectorall
fn QuerySelectorAll(&self, selectors: DOMString) -> Fallible<Temporary<NodeList>> {
let root: &JSRef<Node> = NodeCast::from_ref(self);
root.query_selector_all(selectors)
}
fn GetOnclick(&self) -> Option<EventHandlerNonNull> {
let eventtarget: &JSRef<EventTarget> = EventTargetCast::from_ref(self);
eventtarget.get_event_handler_common("click")