While working on #2149237: Upgrade from Backbone 0.9.2 to >=1.0.0 and from Underscore 1.4.0 to >=1.5.0, I found several subtle bugs (most of which were not causing any problems for the end user):
- There are still a few cases where a model attribute was being changed in response to another attribute change without waiting for the first change to be propagated first.
- When the Entity model enters the 'committing' state, it transitions non-candidate-ish fields to the 'candidate' state. That's good. But it also triggers a 'change:state' event on those fields that are already in a candidate-ish state. That's unnecessary, because a user can only save an entity if changes have been made, and once that happens, it's impossible to not have an in-place editor open, which by definition prevents you from having *only* candidate-ish fields. So at least one field will be transitioned to the 'candidate' state, and hence we don't have to trigger the 'change:state' event on candidate-ish fields.
- While the Entity model is in the 'committing' state, a field may be saved, but in that case, the 'inTempStore' attribute won't be set. While in the 'opened' state, that *does* happen. It should *also* happen while in the 'committing' state.
- The Entity and Field models'
validate()method tried to return early if another attribute than thestateone was being changed. But that code was pointless: Backbone does not support this (it doesn't want to: it wants you to always validate the entire thing). - Only for one View, there was still Edit module-namespaced events in the event map. This is pointless: Backbone already assigns a dynamically generated, unique event namespace to ensure proper unbinding.
Comments
Comment #1
wim leersComment #2
wim leersComment #3
wim leershttp://drupalcode.org/project/edit.git/commit/e182f75