Created
April 17, 2016 18:02
-
-
Save sirdlx/b4dea4dd93a752d82fef78ba16b54897 to your computer and use it in GitHub Desktop.
conditionally load webcomponentsjs
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
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.onload = lazyLoadPolymerAndElements; | |
document.head.appendChild(wcPoly); | |
} else { | |
lazyLoadPolymerAndElements(); | |
} | |
function lazyLoadPolymerAndElements () { | |
// Set up the element imports. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment