webcomponents / polyfills

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

[scoped-custom-element-registry] should always only be applied once #438

Closed daKmoR closed 3 years ago

daKmoR commented 3 years ago

Description

Right now if you load the polyfill multiple times from different locations. (e.g. nested node_modules) it would override each other.

Adding something like this

if (!window.__scopedCustomElementRegistryLoadedPolyfill) {
  window.__scopedCustomElementRegistryLoadedPolyfill = true;

at the top should be good enough to make sure the polyfill does not fail in these cases.

What do you think?