Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Destroy event arguments differ depending model's nesting level. #420

Open
mlilley opened this Issue Nov 21, 2013 · 0 comments

Comments

Projects
None yet
2 participants

mlilley commented Nov 21, 2013

This is a cracker. Given a hierarchy of: [A] has many [B] has many [C].

When an [A] is destroyed, the "destroy" listener receives (model, collection, options) where:

  • model.collection is set, and still contains the model being destroyed.
  • collection still contains the model being destroyed

When a [C] is destroyed, the "destroy" listener receives (model, collection, options) where:

  • model.collection is not set (is undefined)
  • collection does not contain the model being destroyed

Fiddle: http://jsfiddle.net/mglilley/Yz6jY/1/

Why would the destroy listener for a model at the top of the hierarchy be fired before the model has been removed from its collection, and after for a model at the bottom?

@bpatram bpatram added the bug label Mar 26, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment