auto merge of #2632 : brunoabinader/servo/document-queryselectorall, r=Ms2ger

Spec:
http://dom.spec.whatwg.org/#dom-parentnode-queryselectorall

Closes #851.
This commit is contained in:
bors-servo 2014-06-11 16:05:04 -04:00
commit baa97fe6e5
6 changed files with 116 additions and 3 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(&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")