mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
Implement ChildNode.remove()
This commit is contained in:
parent
325a39b8ba
commit
6f310a5c20
8 changed files with 61 additions and 7 deletions
|
@ -425,6 +425,8 @@ pub trait NodeHelpers {
|
|||
|
||||
fn get_bounding_content_box(&self) -> Rect<Au>;
|
||||
fn get_content_boxes(&self) -> Vec<Rect<Au>>;
|
||||
|
||||
fn remove_self(&mut self);
|
||||
}
|
||||
|
||||
impl<'a> NodeHelpers for JSRef<'a, Node> {
|
||||
|
@ -630,6 +632,12 @@ impl<'a> NodeHelpers for JSRef<'a, Node> {
|
|||
document.deref().wait_until_safe_to_modify_dom();
|
||||
}
|
||||
|
||||
fn remove_self(&mut self) {
|
||||
match self.parent_node().root() {
|
||||
Some(ref mut parent) => parent.remove_child(self),
|
||||
None => ()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// If the given untrusted node address represents a valid DOM node in the given runtime,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue