doplumi
doplumi

Reputation: 3118

Why is my <app-globals>'s port to Polymer 1.0 on working in Chrome and not on Firefox/Safari?

I've been trying to port the <app-globals> element behavior, to share variables between elements, as illustrated in the Polymer 0.5 Developer Guide, to Polymer 1.0.

I've got to an element that is full working on Chrome and Chrome for Android, but doesn't seem to work on Safari, Firefox or Chrome for iOS. You can check the live jsbin. Just open it on Chrome to see it working.

Why doesn't it work on Safari/Firefox? How do I make it work?

Upvotes: 0

Views: 92

Answers (1)

Maria
Maria

Reputation: 5604

I found several issues that stopped your example from working. I have a working copy of your code in this Plunker (I had some issues with JS Bin, that's why I moved to Plunker).

Make sure you link the to the scripts correctly (you had href instead of src).

  <script src="webcomponentsjs/webcomponents-lite.min.js"></script>

If you want to create Polymer elements in your main documents, listen to the HTMLImports.whenReady event (docs). This is probably the main reason for problems in Firefox.

HTMLImports.whenReady(function () {
    Polymer({

When you register the element, you need to specify the id again using is.

Polymer({
    is: 'demo-test',
    populate: function() {

Upvotes: 1

Related Questions