webcomponents / polyfills

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

[ShadyCSS] Cannot load the polyfill async #33

Open ebidel opened 8 years ago

ebidel commented 8 years ago

I'm trying to load the polyfills conditionally, async and am not able to shim styles.

http://jsbin.com/qaxifecapa/edit?html,output works in Canary, but not in other browsers.

If you uncomment the <script> tags in that jsbin that load the polyfills and replace this:

lazyLoadWCPolyfillsIfNecessary().then(function(events) {
  if (!supportsShadowDOMV1) {
    ShadyCSS.prepareTemplate(CardSwiper.template, CardSwiper.is);
  }
  window.customElements.define(CardSwiper.is, CardSwiper);
});

with:

ShadyCSS.prepareTemplate(CardSwiper.template, CardSwiper.is);
window.customElements.define(CardSwiper.is, CardSwiper);

then the demo works as expected.

ebidel commented 8 years ago

Sometimes I get the error "window.customElements" is not defined. There seems to be a dep on CE in this polyfill.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.