webcomponents / polyfills

Web Components Polyfills
BSD 3-Clause "New" or "Revised" License
1.13k stars 166 forks source link

[scoped-custom-element-registry]: whenDefined() doesn't work when already defined #443

Closed lazka closed 3 years ago

lazka commented 3 years ago
<script type="module">
import 'https://jspm.dev/@webcomponents/scoped-custom-element-registry/scoped-custom-element-registry.min.js';

class SomethingDifferent extends HTMLElement {}

customElements.define('something-different', SomethingDifferent);

customElements.whenDefined('something-different').then(() => {
    console.log("works"); // this doesn't get called
});
</script>
daKmoR commented 3 years ago

I put it on a codepen https://codepen.io/daKmoR/pen/oNBrVwL

lazka commented 3 years ago

Thanks!