webcomponents / polyfills

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

[scoped-custom-element-registry] lazy definitions seems to not upgrade the element if the same tag name has been defined in global registry #442

Closed manolakis closed 3 years ago

manolakis commented 3 years ago

Description

if we do a lazy component definition over a scoped registry using a tag name previously defined in the global registry, the components are not upgraded.

@kevinpschaaf

Example

See https://github.com/lazka/scoped-test-v2/blob/main/demo.js for a minimal example.

The SomethingDifferent component isn't visible if it is registered globally first and defineScopedElement() is called after the first update.

Two things:

Removing the first customElements.define fixes things Calling this.defineScopedElement earlier (before render) fixes things as well

Steps to reproduce

build the previous example and open the HTML inside the dist folder.

Expected behavior

It should upgrade the component

Actual behavior

The component is not upgraded

Version

scoped-custom-element-registry v0.0.1

daKmoR commented 3 years ago

I put it on codepen for lazy people like me https://codepen.io/daKmoR/pen/rNjErgx

lazka commented 3 years ago

Here is another but that might be related: https://github.com/webcomponents/polyfills/issues/443

kevinpschaaf commented 3 years ago

It looks like it is upgrading, we're just failing to call connectedCallback for an element that is already parsed and in "pending upgrade" state and then is defined later.

lazka commented 3 years ago

Thanks!

lazka commented 3 years ago

Any chance to get a new release of @webcomponents/scoped-custom-element-registry? There have been a bunch of nice fixes/improvements recently :)