Created
March 7, 2017 17:40
-
-
Save kylebuch8/fa62ceb83d31e0e1f60bff4bda8d0e4f to your computer and use it in GitHub Desktop.
Do I need to load the web component polyfill?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ('registerElement' in document | |
&& 'import' in document.createElement('link') | |
&& 'content' in document.createElement('template')) { | |
// browser has web components | |
} else { | |
// polyfill web components | |
var e = document.createElement('script'); | |
e.src = 'bower_components/webcomponentsjs/webcomponents-lite.min.js'; | |
document.head.appendChild(e); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment