Created
April 2, 2015 00:53
-
-
Save appkr/f7501f9119b09cdbeac9 to your computer and use it in GitHub Desktop.
Polymer/Webcomponents conditional polyfill
This file contains 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
<script> | |
if ('registerElement' in document | |
&& 'createShadowRoot' in HTMLElement.prototype | |
&& 'import' in document.createElement('link') | |
&& 'content' in document.createElement('template')) { | |
// We're using a browser with native WC support! | |
} else { | |
document.write( | |
'<script src="https:\/\/cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/0.6.0/webcomponents.min.js"><\/script>' | |
); | |
} | |
</script> | |
<link rel="import" href="my-custom-component.html"> | |
<!-- credit to Glen Maddern, https://github.com/geelen/x-gif --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment