mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Implement ParentNode#replaceChildren
This commit is contained in:
parent
0baa1ea7bd
commit
66f80fbf4f
7 changed files with 29 additions and 100 deletions
|
@ -934,6 +934,18 @@ impl Node {
|
|||
self.AppendChild(&node).map(|_| ())
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-parentnode-replacechildren
|
||||
pub fn replace_children(&self, nodes: Vec<NodeOrString>) -> ErrorResult {
|
||||
// Step 1.
|
||||
let doc = self.owner_doc();
|
||||
let node = doc.node_from_nodes_and_strings(nodes)?;
|
||||
// Step 2.
|
||||
Node::ensure_pre_insertion_validity(&node, self, None)?;
|
||||
// Step 3.
|
||||
Node::replace_all(Some(&node), self);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-parentnode-queryselector
|
||||
pub fn query_selector(&self, selectors: DOMString) -> Fallible<Option<DomRoot<Element>>> {
|
||||
// Step 1.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue