mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Added ParentNode.querySelector skeleton
This commit is contained in:
parent
f78d04b620
commit
f0aadb790d
4 changed files with 23 additions and 0 deletions
|
@ -328,6 +328,7 @@ pub trait DocumentMethods {
|
||||||
fn Applets(&self) -> Temporary<HTMLCollection>;
|
fn Applets(&self) -> Temporary<HTMLCollection>;
|
||||||
fn Location(&self) -> Temporary<Location>;
|
fn Location(&self) -> Temporary<Location>;
|
||||||
fn Children(&self) -> Temporary<HTMLCollection>;
|
fn Children(&self) -> Temporary<HTMLCollection>;
|
||||||
|
fn QuerySelector(&self, selectors: DOMString) -> Fallible<Option<Temporary<Element>>>;
|
||||||
fn GetOnload(&self) -> Option<EventHandlerNonNull>;
|
fn GetOnload(&self) -> Option<EventHandlerNonNull>;
|
||||||
fn SetOnload(&mut self, listener: Option<EventHandlerNonNull>);
|
fn SetOnload(&mut self, listener: Option<EventHandlerNonNull>);
|
||||||
}
|
}
|
||||||
|
@ -810,6 +811,10 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
||||||
HTMLCollection::children(&*window, NodeCast::from_ref(self))
|
HTMLCollection::children(&*window, NodeCast::from_ref(self))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn QuerySelector(&self, selectors: DOMString) -> Fallible<Option<Temporary<Element>>> {
|
||||||
|
Ok(None)
|
||||||
|
}
|
||||||
|
|
||||||
fn GetOnload(&self) -> Option<EventHandlerNonNull> {
|
fn GetOnload(&self) -> Option<EventHandlerNonNull> {
|
||||||
let eventtarget: &JSRef<EventTarget> = EventTargetCast::from_ref(self);
|
let eventtarget: &JSRef<EventTarget> = EventTargetCast::from_ref(self);
|
||||||
eventtarget.get_event_handler_common("load")
|
eventtarget.get_event_handler_common("load")
|
||||||
|
|
|
@ -7,10 +7,12 @@ use dom::bindings::codegen::Bindings::DocumentFragmentBinding;
|
||||||
use dom::bindings::js::{JSRef, Temporary};
|
use dom::bindings::js::{JSRef, Temporary};
|
||||||
use dom::bindings::error::Fallible;
|
use dom::bindings::error::Fallible;
|
||||||
use dom::document::Document;
|
use dom::document::Document;
|
||||||
|
use dom::element::Element;
|
||||||
use dom::eventtarget::{EventTarget, NodeTargetTypeId};
|
use dom::eventtarget::{EventTarget, NodeTargetTypeId};
|
||||||
use dom::htmlcollection::HTMLCollection;
|
use dom::htmlcollection::HTMLCollection;
|
||||||
use dom::node::{DocumentFragmentNodeTypeId, Node, window_from_node};
|
use dom::node::{DocumentFragmentNodeTypeId, Node, window_from_node};
|
||||||
use dom::window::{Window, WindowMethods};
|
use dom::window::{Window, WindowMethods};
|
||||||
|
use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[deriving(Encodable)]
|
#[deriving(Encodable)]
|
||||||
pub struct DocumentFragment {
|
pub struct DocumentFragment {
|
||||||
|
@ -46,6 +48,7 @@ impl DocumentFragment {
|
||||||
|
|
||||||
pub trait DocumentFragmentMethods {
|
pub trait DocumentFragmentMethods {
|
||||||
fn Children(&self) -> Temporary<HTMLCollection>;
|
fn Children(&self) -> Temporary<HTMLCollection>;
|
||||||
|
fn QuerySelector(&self, selectors: DOMString) -> Fallible<Option<Temporary<Element>>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> DocumentFragmentMethods for JSRef<'a, DocumentFragment> {
|
impl<'a> DocumentFragmentMethods for JSRef<'a, DocumentFragment> {
|
||||||
|
@ -53,4 +56,8 @@ impl<'a> DocumentFragmentMethods for JSRef<'a, DocumentFragment> {
|
||||||
let window = window_from_node(self).root();
|
let window = window_from_node(self).root();
|
||||||
HTMLCollection::children(&window.root_ref(), NodeCast::from_ref(self))
|
HTMLCollection::children(&window.root_ref(), NodeCast::from_ref(self))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn QuerySelector(&self, selectors: DOMString) -> Fallible<Option<Temporary<Element>>> {
|
||||||
|
Ok(None)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -429,6 +429,7 @@ pub trait ElementMethods {
|
||||||
fn GetInnerHTML(&self) -> Fallible<DOMString>;
|
fn GetInnerHTML(&self) -> Fallible<DOMString>;
|
||||||
fn GetOuterHTML(&self) -> Fallible<DOMString>;
|
fn GetOuterHTML(&self) -> Fallible<DOMString>;
|
||||||
fn Children(&self) -> Temporary<HTMLCollection>;
|
fn Children(&self) -> Temporary<HTMLCollection>;
|
||||||
|
fn QuerySelector(&self, selectors: DOMString) -> Fallible<Option<Temporary<Element>>>;
|
||||||
fn Remove(&self);
|
fn Remove(&self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -704,6 +705,10 @@ impl<'a> ElementMethods for JSRef<'a, Element> {
|
||||||
HTMLCollection::children(&*window, NodeCast::from_ref(self))
|
HTMLCollection::children(&*window, NodeCast::from_ref(self))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn QuerySelector(&self, selectors: DOMString) -> Fallible<Option<Temporary<Element>>> {
|
||||||
|
Ok(None)
|
||||||
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-childnode-remove
|
// http://dom.spec.whatwg.org/#dom-childnode-remove
|
||||||
fn Remove(&self) {
|
fn Remove(&self) {
|
||||||
let node: &JSRef<Node> = NodeCast::from_ref(self);
|
let node: &JSRef<Node> = NodeCast::from_ref(self);
|
||||||
|
|
|
@ -22,4 +22,10 @@ interface ParentNode {
|
||||||
// Not implemented yet
|
// Not implemented yet
|
||||||
// void prepend((Node or DOMString)... nodes);
|
// void prepend((Node or DOMString)... nodes);
|
||||||
// void append((Node or DOMString)... nodes);
|
// void append((Node or DOMString)... nodes);
|
||||||
|
|
||||||
|
//Element? query(DOMString relativeSelectors);
|
||||||
|
//[NewObject] Elements queryAll(DOMString relativeSelectors);
|
||||||
|
[Throws]
|
||||||
|
Element? querySelector(DOMString selectors);
|
||||||
|
//[NewObject] NodeList querySelectorAll(DOMString selectors);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue