documentcloud/backbone — Issue #924: Previous Attributes behaviour confusing or incorrect.
Author: Douglasj
Created: 2012-02-01 19:56:50+00:00
State: open

I am not sure if this is as-designed but, to me, this behaviour seems very confusing.

Given this node.js application:
https://gist.github.com/1718943#

I would expect hasChanged() to be true and previousAttributes to be { var1: 'a' }. Tracing through the code I could see hasChanged() returning false as an artefact of the transition from client to server-side.

But the previousAttributes() doesn't make much sense to me. I see where it gets set (model.change(), after all change events have fired it sets previousAttributes to current attributes). But client or server it seems to me that previousAttributes should always be the previous attributes. Each set would update their state as a whole. The way the code is right now previousAttributes, save a small window during change events, are always the current attributes.

Shouldn't previous attributes be the last attribute-set always?