// 4. Conditionally load the webcomponents polyfill if needed by the browser. // This feature detect will need to change over time as browsers implement // different features. var webComponentsSupported = ('registerElement' in document && 'import' in document.createElement('link') && 'content' in document.createElement('template')); function createScript(file) { var script = document.createElement('script'); script.async = true; script.src = file; document.head.appendChild(script); } function createLink(file) { var link = document.createElement('link'); link.async = true; link.href = file; link.rel = 'import'; document.head.appendChild(link); } if (!webComponentsSupported) { createScript('../../webcomponents-lite.js'); createLink('../css/non-chrome-shadow.html'); } else { createLink('../css/chrome-shadow.html'); }