canjs / can-stache-bindings

Binding helpers for CanJS template engines
https://canjs.com/doc/can-stache-bindings.html
MIT License
8 stars 8 forks source link

support nullish contexts for binding with :by #511

Closed michaelzcheng closed 5 years ago

michaelzcheng commented 5 years ago

This resolves: https://github.com/canjs/can-stache-bindings/issues/510

We want to support event binding to a context which might be undefined through the :by attribute.

The change in functionality will create an observation which watches the context suggested through :by and rebinds the actual event handler when that context changes. This permits null values, initial or otherwise.

Please provide feedback on test cases, if you can think of something that I missed!

bmomberger-bitovi commented 5 years ago

Confirmed working for my intended use case via https://jsbin.com/nolobokuyo/1/edit?html,js,output