googlearchive / TemplateBinding

TemplateBinding Prolyfill
290 stars 61 forks source link

TemplateBinding has internal TemplateIterator type as its "node" #127

Closed jmesserly closed 11 years ago

jmesserly commented 11 years ago

I'm not sure if NodeBinding is intended to be public API or not, but it is returned by [Node.prototype.createBinding] and the "bindings" Map on Node. One of its public properties is "NodeBinding.node". For most of the bindings that means exactly what you'd expect (the Node that created the binding). However, for HTMLTemplateElement, the ".node" property is the TemplateIterator. This also means TemplateIterator is now exposed via querySelector('template').bindings[name].node ... which would let you potentially do bad things like muck with the ".inputs" CompoundBinding or the ".terminators" list, etc.

See: https://github.com/Polymer/mdv/blob/master/src/template_element.js#L820

jmesserly commented 11 years ago

another small detail, path || '' appears twice in the code, once in HTMLTemplateElement.prototype.createBinding, and once in TemplateBinding constructor.

Also: I'm not sure why path || '' is not used for other bindings?

rafaelw commented 11 years ago

https://github.com/Polymer/mdv/commit/32d409c09930e53d47256638f710a696dc39080f

rafaelw commented 11 years ago

And https://github.com/Polymer/mdv/commit/05fe3fad7c282009c7ab5a5a0d9b13502a98c550

jmesserly commented 11 years ago

awesome!