mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Throw when trying to import or adopt a shadow root
This commit is contained in:
parent
6a85409ffe
commit
f6ba165882
1 changed files with 8 additions and 2 deletions
|
@ -87,6 +87,7 @@ use crate::dom::progressevent::ProgressEvent;
|
|||
use crate::dom::promise::Promise;
|
||||
use crate::dom::range::Range;
|
||||
use crate::dom::servoparser::ServoParser;
|
||||
use crate::dom::shadowroot::ShadowRoot;
|
||||
use crate::dom::storageevent::StorageEvent;
|
||||
use crate::dom::stylesheetlist::StyleSheetList;
|
||||
use crate::dom::text::Text;
|
||||
|
@ -3625,7 +3626,7 @@ impl DocumentMethods for Document {
|
|||
// https://dom.spec.whatwg.org/#dom-document-importnode
|
||||
fn ImportNode(&self, node: &Node, deep: bool) -> Fallible<DomRoot<Node>> {
|
||||
// Step 1.
|
||||
if node.is::<Document>() {
|
||||
if node.is::<Document>() || node.is::<ShadowRoot>() {
|
||||
return Err(Error::NotSupported);
|
||||
}
|
||||
|
||||
|
@ -3647,9 +3648,14 @@ impl DocumentMethods for Document {
|
|||
}
|
||||
|
||||
// Step 2.
|
||||
Node::adopt(node, self);
|
||||
if node.is::<ShadowRoot>() {
|
||||
return Err(Error::HierarchyRequest);
|
||||
}
|
||||
|
||||
// Step 3.
|
||||
Node::adopt(node, self);
|
||||
|
||||
// Step 4.
|
||||
Ok(DomRoot::from_ref(node))
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue