Skip to content

Instantly share code, notes, and snippets.

@SmokyBob
Created November 23, 2014 14:18
Show Gist options
  • Save SmokyBob/82028bb6ad860bc1ce64 to your computer and use it in GitHub Desktop.
Save SmokyBob/82028bb6ad860bc1ce64 to your computer and use it in GitHub Desktop.
webcomponents load only when needed
<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/polymer/0.3.4/platform.js"><\/script>')
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment