Skip to content

Instantly share code, notes, and snippets.

@jshcrowthe
Last active July 14, 2016 19:03
Show Gist options
  • Save jshcrowthe/cbe5d44a93cfceaf6650 to your computer and use it in GitHub Desktop.
Save jshcrowthe/cbe5d44a93cfceaf6650 to your computer and use it in GitHub Desktop.
Conditionally Load WC Polyfill
var webComponentsSupported = ('registerElement' in document
&& 'import' in document.createElement('link')
&& 'content' in document.createElement('template'));
if (!webComponentsSupported) {
var wcPoly = document.createElement('script');
wcPoly.src = '/bower_components/webcomponentsjs/webcomponents-lite.js';
wcPoly.async = true;
(document.head || document.getElementsByTagName("head")[0]).appendChild(wcPoly);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment