mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Upgrade to SM 39
This commit is contained in:
parent
a256f39796
commit
675267b782
205 changed files with 6546 additions and 5340 deletions
|
@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
|
|||
use dom::bindings::codegen::InheritTypes::DocumentFragmentDerived;
|
||||
use dom::bindings::codegen::InheritTypes::{ElementCast, NodeCast};
|
||||
use dom::bindings::codegen::UnionTypes::NodeOrString;
|
||||
use dom::bindings::js::{JSRef, Rootable, Temporary};
|
||||
use dom::bindings::js::Root;
|
||||
use dom::bindings::error::{ErrorResult, Fallible};
|
||||
use dom::bindings::global::GlobalRef;
|
||||
use dom::document::Document;
|
||||
|
@ -33,40 +33,39 @@ impl DocumentFragmentDerived for EventTarget {
|
|||
|
||||
impl DocumentFragment {
|
||||
/// Creates a new DocumentFragment.
|
||||
fn new_inherited(document: JSRef<Document>) -> DocumentFragment {
|
||||
fn new_inherited(document: &Document) -> DocumentFragment {
|
||||
DocumentFragment {
|
||||
node: Node::new_inherited(NodeTypeId::DocumentFragment, document),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new(document: JSRef<Document>) -> Temporary<DocumentFragment> {
|
||||
pub fn new(document: &Document) -> Root<DocumentFragment> {
|
||||
Node::reflect_node(box DocumentFragment::new_inherited(document),
|
||||
document, DocumentFragmentBinding::Wrap)
|
||||
}
|
||||
|
||||
pub fn Constructor(global: GlobalRef) -> Fallible<Temporary<DocumentFragment>> {
|
||||
pub fn Constructor(global: GlobalRef) -> Fallible<Root<DocumentFragment>> {
|
||||
let document = global.as_window().Document();
|
||||
let document = document.root();
|
||||
|
||||
Ok(DocumentFragment::new(document.r()))
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> DocumentFragmentMethods for JSRef<'a, DocumentFragment> {
|
||||
impl<'a> DocumentFragmentMethods for &'a DocumentFragment {
|
||||
// https://dom.spec.whatwg.org/#dom-parentnode-children
|
||||
fn Children(self) -> Temporary<HTMLCollection> {
|
||||
let window = window_from_node(self).root();
|
||||
fn Children(self) -> Root<HTMLCollection> {
|
||||
let window = window_from_node(self);
|
||||
HTMLCollection::children(window.r(), NodeCast::from_ref(self))
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-parentnode-firstelementchild
|
||||
fn GetFirstElementChild(self) -> Option<Temporary<Element>> {
|
||||
fn GetFirstElementChild(self) -> Option<Root<Element>> {
|
||||
NodeCast::from_ref(self).child_elements().next()
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-parentnode-lastelementchild
|
||||
fn GetLastElementChild(self) -> Option<Temporary<Element>> {
|
||||
NodeCast::from_ref(self).rev_children().filter_map(ElementCast::to_temporary).next()
|
||||
fn GetLastElementChild(self) -> Option<Root<Element>> {
|
||||
NodeCast::from_ref(self).rev_children().filter_map(ElementCast::to_root).next()
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-parentnode-childelementcount
|
||||
|
@ -85,14 +84,14 @@ impl<'a> DocumentFragmentMethods for JSRef<'a, DocumentFragment> {
|
|||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-parentnode-queryselector
|
||||
fn QuerySelector(self, selectors: DOMString) -> Fallible<Option<Temporary<Element>>> {
|
||||
let root: JSRef<Node> = NodeCast::from_ref(self);
|
||||
fn QuerySelector(self, selectors: DOMString) -> Fallible<Option<Root<Element>>> {
|
||||
let root = NodeCast::from_ref(self);
|
||||
root.query_selector(selectors)
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-parentnode-queryselectorall
|
||||
fn QuerySelectorAll(self, selectors: DOMString) -> Fallible<Temporary<NodeList>> {
|
||||
let root: JSRef<Node> = NodeCast::from_ref(self);
|
||||
fn QuerySelectorAll(self, selectors: DOMString) -> Fallible<Root<NodeList>> {
|
||||
let root = NodeCast::from_ref(self);
|
||||
root.query_selector_all(selectors)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue