Search code examples
web-componentpolyfills

Web component - polyfill not working on firefox and safari


i have a simple index.html with an import of a component, exaclty this. On Chrome works fine, but on others browser (i tried firefox and safari) not, it shows only the index.html content, not the template content of the component. I read this and it seems like my situation, but this solution doesn't work for me.

EDIT: imports are correct (from IDE, if I command+click on links, I can go to the .js)


Solution

  • It's because document.currentScript doesn't work with polyfill.

    You should use instead :

    ( document._currentScript || document.currentScript )
    

    Update: Or you can use the new version of HTML Imports polyfill, that makes document.currentScript work as expected.