[whatwg/dom] Repeatedly inserting a custom element may upgrade it twice (#261)

Say I have two custom elements—call them A and B—of the same type, in a document, and then I define this kind of element. This enqueues upgrade reactions for A and B.

If, during A's constructor, it removes and reinserts B, [node insert](https://dom.spec.whatwg.org/#concept-node-insert) step 6.5.2.2 enqueues a second upgrade reaction for B. This is implementable, but it seems error prone for authors if B's constructor runs twice.

One possibility is to have [upgrade an element](https://html.spec.whatwg.org/multipage/scripting.html#concept-upgrade-an-element) bail out if the element's custom element state is already "custom."

The edge cases are tricky so this may need some careful thinking through. For example, I think you need to do this check when running the upgrade step and not when enqueuing it to make the adoption case work.

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/261

Received on Wednesday, 1 June 2016 04:27:13 UTC