mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Throw NotSupported when trying to deep clone a shadow root
This commit is contained in:
parent
d6ddb08e23
commit
6a85409ffe
3 changed files with 18 additions and 13 deletions
|
@ -280,7 +280,9 @@ impl Node {
|
|||
|
||||
new_child.parent_node.set(Some(self));
|
||||
if let Some(shadow_root) = self.downcast::<ShadowRoot>() {
|
||||
new_child.composed_parent_node.set(Some(shadow_root.Host().upcast::<Node>()));
|
||||
new_child
|
||||
.composed_parent_node
|
||||
.set(Some(shadow_root.Host().upcast::<Node>()));
|
||||
} else {
|
||||
new_child.composed_parent_node.set(Some(self));
|
||||
}
|
||||
|
@ -2528,8 +2530,11 @@ impl NodeMethods for Node {
|
|||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-node-clonenode
|
||||
fn CloneNode(&self, deep: bool) -> DomRoot<Node> {
|
||||
Node::clone(
|
||||
fn CloneNode(&self, deep: bool) -> Fallible<DomRoot<Node>> {
|
||||
if deep && self.is::<ShadowRoot>() {
|
||||
return Err(Error::NotSupported);
|
||||
}
|
||||
Ok(Node::clone(
|
||||
self,
|
||||
None,
|
||||
if deep {
|
||||
|
@ -2537,7 +2542,7 @@ impl NodeMethods for Node {
|
|||
} else {
|
||||
CloneChildrenFlag::DoNotCloneChildren
|
||||
},
|
||||
)
|
||||
))
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-node-isequalnode
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue