whatwg/dom

Element.attachShadow should set the declarative flag to false of an existing declarative shadow dom.

emilio opened this issue · 4 comments

emilio commented

What is the issue with the DOM Standard?

That matches the current implementations, and makes sense.

https://dom.spec.whatwg.org/#concept-attach-a-shadow-root doesn't change the declarative flag if you hit the branch in step 4, and https://dom.spec.whatwg.org/#dom-element-attachshadow doesn't override the declarative flag to false either.

That means that, per spec, if you .attachShadow() on a node with a declarative Shadow DOM, calling .attachShadow() again will keep working and keep returning the same node over and over.

cc @mfreed7 @rniwa @annevk @avandolder

Hmm, interesting point. I agree, that would be bad. Nicely, at least in terms of Chromium and WebKit behavior, this already seems to be the case:

https://jsbin.com/xisolipenu/edit?html,output

We should fix the spec to match the implementations. I can put up a spec PR, unless you'd like to.

emilio commented

If you can that'd be great. Otherwise I can try to get some time for that.

If you can that'd be great. Otherwise I can try to get some time for that.

No problem - I'll see if I can find time soon to do that, and if that doesn't happen in a few weeks, I'll ask for help. Sound ok?

emilio commented

Sounds great, thanks!