Created
October 9, 2014 17:35
-
-
Save mkxml/93ad51b790b1e58f28a3 to your computer and use it in GitHub Desktop.
Polymer platform.js Web Components polyfill conditional loader
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> | |
var wc = document.registerElement && | |
window.HTMLTemplateElement && | |
window.ShadowRoot && | |
window.WeakMap && | |
window.MutationObserver && | |
("import" in document.createElement("link")); | |
if(!wc) { | |
var polyfill = document.createElement("script"); | |
polyfill.src = "polymer/platform.js"; | |
document.head.appendChild(polyfill); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use this on
<head>
to load the polymer platform polyfills based on browser's support to the web components standards. Example: Chrome won't load it because it has full Web Components support.