documentcloud/backbone — pull request #2589 by christianalfoni (2013-06-05 14:11:50+00:00)
Title: Prevent initialize when instantiating temporary merge model

When a collection fetches updates on its models it uses the _prepareModel method to set up a new model with the fetched attributes. Either this model becomes a new model in the collection or it is used to merge with an existing model.

A problem can occur when it instantiates a new model and the initialize method runs. The initialize method is often customized by the developer and can contain some harmful, or at least totally unnecessary code for merging purposes.

Specifically I run into a scenario where my model listened to events in the initialize method, causing the temporary merge-model to never stop listening after the merge.

But this is just one scenario. I think it is a good principle to not trigger the initialize-method since Backbone tries to do its own thing and triggering initilize can cause all sorts of havoc.

Instead the initialize method is run right before it is added to the collection, so the only delay is the check for "merge".

I do see an issue if you have manipulated the attributes in the initialize method, but manipulating attributes on instantiation should be done with a parse method.