Skip to content Skip to sidebar Skip to footer

Polymer 1.0 On Firefox Referenceerror: Polymer Is Not Defined

Hello I have a working Polymer 1.0 web page on Chrome and Opera. Now I need the page to run in Firefox and Safari. I have the following test:

Solution 1:

Try wrapping your javascript under addEventListener('WebComponentsReady', function() {}).

addEventListener('WebComponentsReady', function() {
            Polymer({
                is: "test-element"
            });
})

This will ensure the webcomponents polyfill is completed for browsers that do not support it. If the element is imported using html import then the event listener is not required. Please refer to https://github.com/webcomponents/webcomponentsjs#webcomponentsready for more details.

Response for the edit: import polymer.html in your test-element file and 'remove' it from your index.html file. The best approach is to define an elements.html file, import all your elements (including test-element) into your elements.html file and import elements.html file into your index.html file. Also in each of your elements file (like test-element.html) make sure you import all the dependencies. I would suggest you to start with polymer-starter-kit

Post a Comment for "Polymer 1.0 On Firefox Referenceerror: Polymer Is Not Defined"