mirror of
https://github.com/servo/servo.git
synced 2025-06-19 06:38:59 +01:00
Add overridable tree binding/unbinding behaviour.
This commit is contained in:
parent
f5d1907195
commit
6388dec996
3 changed files with 39 additions and 10 deletions
|
@ -19,12 +19,12 @@ use dom::comment::Comment;
|
|||
use dom::document::{Document, HTMLDocument, NonHTMLDocument};
|
||||
use dom::documentfragment::DocumentFragment;
|
||||
use dom::documenttype::DocumentType;
|
||||
use dom::element::{Element, ElementTypeId, HTMLAnchorElementTypeId, IElement};
|
||||
use dom::element::{Element, ElementTypeId, HTMLAnchorElementTypeId};
|
||||
use dom::eventtarget::{EventTarget, NodeTargetTypeId};
|
||||
use dom::nodelist::{NodeList};
|
||||
use dom::processinginstruction::ProcessingInstruction;
|
||||
use dom::text::Text;
|
||||
use dom::virtualmethods::VirtualMethods;
|
||||
use dom::virtualmethods::{VirtualMethods, vtable_for};
|
||||
use dom::window::Window;
|
||||
use html::hubbub_html_parser::build_element_from_tag;
|
||||
use layout_interface::{LayoutChan, ReapLayoutDataMsg, UntrustedNodeAddress};
|
||||
|
@ -404,10 +404,7 @@ impl NodeHelpers for JS<Node> {
|
|||
|
||||
if self.is_in_doc() {
|
||||
for node in self.traverse_preorder() {
|
||||
if node.is_element() {
|
||||
let element: JS<Element> = ElementCast::to(&node).unwrap();
|
||||
element.bind_to_tree_impl();
|
||||
}
|
||||
vtable_for(&node).bind_to_tree();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -420,10 +417,8 @@ impl NodeHelpers for JS<Node> {
|
|||
let document = document_from_node(self);
|
||||
|
||||
for node in self.traverse_preorder() {
|
||||
if node.is_element() {
|
||||
let element: JS<Element> = ElementCast::to(&node).unwrap();
|
||||
element.unbind_from_tree_impl();
|
||||
}
|
||||
// XXX how about if the node wasn't in the tree in the first place?
|
||||
vtable_for(&node).unbind_from_tree();
|
||||
}
|
||||
|
||||
document.get().content_changed();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue