Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

importNode and adoptNode should throw with passed a ShadowRoot #125

Closed
inscriber opened this issue Jun 24, 2015 · 6 comments
Closed

importNode and adoptNode should throw with passed a ShadowRoot #125

inscriber opened this issue Jun 24, 2015 · 6 comments

Comments

@inscriber
Copy link

Given that cloneNode throws with a shadow root, importNode should also throw because one of the steps in the import algorithm it to clone the node. Also, adoptNode should also throw because the host and shadow root shouldn't have different node documents.

@samgiles
Copy link

Does this necessitate a change in the DOM L4 spec? https://dom.spec.whatwg.org/#dom-document-importnodenode-deep to something along these lines (also adding the caveat for adoptNode):

The importNode(node, deep) method must run these steps:

  • If node is a document or ShadowRoot, throw a NotSupportedError exception.
  • Return a clone of node, with context object and the clone children flag set if deep is true.

@domenic
Copy link
Collaborator

domenic commented Jun 25, 2015

In general basically all of the shadow DOM spec is a giant patch on the DOM spec, so that wouldn't be surprising. I would expect eventual integration once we get something shipping in multiple browsers...

@hayatoito
Copy link
Contributor

Yeah, upstreaming Shadow DOM spec to DOM spec has been a long term goal for years.

For a small change like this, I think it's okay to update DOM spec directly rather than Shadow DOM spec.

@hayatoito
Copy link
Contributor

BTW, we can use LayoutRoot here, rather than document or ShadowRoot.
See https://www.w3.org/Bugs/Public/show_bug.cgi?id=28748
Though LayoutRoot is still in the air. No one has started to work on this, I guess.

@annevk
Copy link
Collaborator

annevk commented Jun 25, 2015

@samgiles would you be willing to submit a PR to https://github.com/whatwg/dom?

@hayatoito
Copy link
Contributor

Thanks. Let me close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants