googlearchive / TemplateBinding

TemplateBinding Prolyfill
290 stars 56 forks source link

Binding arbitrary text has stopped working #120

Closed chrisbu closed 11 years ago

chrisbu commented 11 years ago

It may be the way I'm using it, but it seems that binding now only works when the bind property is encompassed by a node.

<template id="my-template" bind>
   <!-- expect "Hello World" to be output -->
   <h2>Hello <span>{{ name }}</span> </h2>  <!-- works in master -->
   <h2>Hello {{ name }} </h2> <!-- broken (works in stable) -->
</template>

<script>
  document.addEventListener('DOMContentLoaded', function() {
    var t = document.querySelector("#my-template");
    t.model = {  name: 'World' };
    Platform.performMicrotaskCheckpoint();
  });
 </script>

The error thrown is

Exception caught during observer callback: TypeError: Cannot read property 'node' of undefined 

and it comes from this line: https://github.com/Polymer/mdv/blob/master/src/template_element.js#L187

this.node[this.property] = this.filterModelValue(value);

where this is undefined.

rafaelw commented 11 years ago

I believe this is now fix. Please re-open if it's not. Sorry for the breakage.

chrisbu commented 11 years ago

Working fine now - thanks.