Cormant-Incorporated / backbone-nested-types

Backbone Model mixin that provides toJSON(), parse(), and validate() implementations for models with nested types.
MIT License
5 stars 1 forks source link

Event propagation #10

Open russplaysguitar opened 7 years ago

russplaysguitar commented 7 years ago

Currently, the mixin does not propagate Backbone events of nested types up to the parent model. It makes sense for the mixin to do that.

One specific situation that would be good to propagate events in is when nested models trigger "invalid" due to the server returning invalid nested data from a parent.save(). Although this is an unusual case, it can occur and is confusing to debug. Currently, if you have an "invalid" listener on the parent, it would not be triggered because the child's "invalid" event would not propagate.