[bug] Custom Elements fail to upgrade when inserted into slotted context
When inserting a Custom Element into an element that is distributing children into slots, the Custom Element is not upgraded.
This problem was originally found when using lit-html to re-render lists inside an element with slotted content: Polymer/lit-html#392
A reproduction of the issue can be found here: https://codepen.io/ruphin/pen/BPNPgy?editors=1010
The issue was probably not discovered before, because the MutationObserver would most likely handle the first nodes causing them to be upgraded as normal. However, once the MutationObserver is disconnected the patched functions fail to trigger. This happens because _asyncRender uses the native insertBefore instead of the patched one.
Wrong repo, sorry!