googlearchive / TemplateBinding

TemplateBinding Prolyfill
290 stars 61 forks source link

this.$ is not populated with ids from template #177

Closed pstjvn closed 9 years ago

pstjvn commented 9 years ago

If I have two templates that are mutually exclusive the one that is excluded when first evaluated does not populate the 'this.$' object with the corresponding IDs.

Example:

<polymer-element name="example-app">

<template if="{{a}}">
<div id="div1"></div>
</template>

<template if="{{!a}}">
<div id="div2"></div>
</template>

<script>
Polymer('example-app', {
  a: false,
  ready: function() {
    setTimeout(function() { this.a = true; }.bind(this), 5000);
    setTimeout(function() { console.log(this.$); /* will be empty, should contain 'div1' */}.bind(this), 15000);
  }
});
</script>
</polymer-element>

Tested with latest master.

ajklein commented 9 years ago

This issue is tracked at Polymer/polymer#642