googlearchive / TemplateBinding

TemplateBinding Prolyfill
290 stars 61 forks source link

Compound path e.g. foo="{{foo1}} {{foo2}}" causes the next binding to not work #141

Closed frankiefu closed 10 years ago

frankiefu commented 10 years ago
<template id="t" bind>
  <div id="test" foo="{{foo1}} {{foo2}}" bar="{{bar}}"></div>
</template>

<script>
document.addEventListener('DOMContentLoaded', function() {
  var model = {
    foo1: 'foo1Value',
    foo2: 'foo2Value',
    bar: 'barValue'
  };

  document.getElementById('t').model = model;
  Platform.performMicrotaskCheckpoint();
});
</script>

If you inspect div#test you will see bar is not updated.

<div id="test" foo="foo1Value foo2Value" bar="{{bar}}"></div>

I see that in TemplateBinding.js::processBindings: https://github.com/Polymer/TemplateBinding/blob/master/src/TemplateBinding.js#L669 That for loop and the outer for loop are both using var i and that might be the reason causing the next binding to be skipped.

arv commented 10 years ago

That's exactly the issue. Committing patch now.

arv commented 10 years ago

https://github.com/Polymer/TemplateBinding/commit/427c58e9b19080a1f3c6ce80ea223e5e2660da0d