mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Implement querySelector for DocumentFragment
This commit is contained in:
parent
249c484c24
commit
c874c6470c
1 changed files with 5 additions and 2 deletions
|
@ -10,7 +10,7 @@ use dom::document::Document;
|
|||
use dom::element::Element;
|
||||
use dom::eventtarget::{EventTarget, NodeTargetTypeId};
|
||||
use dom::htmlcollection::HTMLCollection;
|
||||
use dom::node::{DocumentFragmentNodeTypeId, Node, window_from_node};
|
||||
use dom::node::{DocumentFragmentNodeTypeId, Node, NodeHelpers, window_from_node};
|
||||
use dom::window::{Window, WindowMethods};
|
||||
use servo_util::str::DOMString;
|
||||
|
||||
|
@ -52,12 +52,15 @@ pub trait DocumentFragmentMethods {
|
|||
}
|
||||
|
||||
impl<'a> DocumentFragmentMethods for JSRef<'a, DocumentFragment> {
|
||||
// http://dom.spec.whatwg.org/#dom-parentnode-children
|
||||
fn Children(&self) -> Temporary<HTMLCollection> {
|
||||
let window = window_from_node(self).root();
|
||||
HTMLCollection::children(&window.root_ref(), NodeCast::from_ref(self))
|
||||
}
|
||||
|
||||
// http://dom.spec.whatwg.org/#dom-parentnode-queryselector
|
||||
fn QuerySelector(&self, selectors: DOMString) -> Fallible<Option<Temporary<Element>>> {
|
||||
Ok(None)
|
||||
let root: &JSRef<Node> = NodeCast::from_ref(self);
|
||||
root.query_selector(selectors)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue