You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Events returned to handlers bound through can.Observe.delegate have the wrong value for the currentTarget property. Currently it will be set the same as the target property, which is set to the can.Observe instance that originally triggered the change event. The currentTarget property should be set to the element on which the handler is executing (i.e. to which the delegate selector points).
The full family of target properties should be set as follows:
delegateTarget should be set to the observable on which the delegated event handler is registered.
currentTarget should be set to the observable to which the delegate selector points. (This observable should also be the context object of the event handler.)
target should be set to the observable from which the change event originated, before bubbling up the object tree.
It's important to have the right currentTarget configured when dealing with deeply nested observables or observable lists (i.e. tree structures) where one must apply different event handling logic depending on which 'level' of the data the event came from.
E.g. you could have templated event bindings in a can.Control that say:
"{tree} items add" : function(el,event,newVal,oldVal,prop){if(event.currentTarget===event.target){// Only take action for 'add' events that originated from// the top level `items` list.}},"{tree} items.*.items add" : function(el,event,newVal,oldVal,prop){// Take action for 'add' events that came from// the sub level items list.}
The text was updated successfully, but these errors were encountered:
Events returned to handlers bound through
can.Observe.delegate
have the wrong value for thecurrentTarget
property. Currently it will be set the same as thetarget
property, which is set to thecan.Observe
instance that originally triggered thechange
event. ThecurrentTarget
property should be set to the element on which the handler is executing (i.e. to which the delegate selector points).The full family of target properties should be set as follows:
delegateTarget
should be set to the observable on which the delegated event handler is registered.currentTarget
should be set to the observable to which the delegate selector points. (This observable should also be the context object of the event handler.)target
should be set to the observable from which thechange
event originated, before bubbling up the object tree.It's important to have the right
currentTarget
configured when dealing with deeply nested observables or observable lists (i.e. tree structures) where one must apply different event handling logic depending on which 'level' of the data the event came from.E.g. you could have templated event bindings in a
can.Control
that say:The text was updated successfully, but these errors were encountered: