Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polyfill web-animations-next-lite loading only on non Chrome browsers #189

Open
JosefJezek opened this issue Jun 19, 2016 · 0 comments
Open

Comments

@JosefJezek
Copy link

JosefJezek commented Jun 19, 2016

On Chrome have this polyfill unnecessarily size 15KB.

https://github.com/web-animations/web-animations-js

Load script on demand like as this code...

var webComponentsSupported = (
      'registerElement' in document
      && 'import' in document.createElement('link')
      && 'content' in document.createElement('template')
    );
    // Load webcomponentsjs polyfill if browser doesn't support native Web Components.
    if (!webComponentsSupported) {
      var script = document.createElement('script');
      script.async = true;
      script.src = 'bower_components/webcomponentsjs/webcomponents-lite.min.js';
      script.onload = onload;
      document.head.appendChild(script);
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant