SpiderOak/SpiderOakMobileClient — pull request #336 by kenmanheimer (2013-10-11 21:19:51+00:00)
Title: Issue 79 unpin backbone

Fixes #79.

This adjusts our code to accommodate update of several pieces of infrastructure dependencies to their currently released versions: backbone, Zepto, chai, sinon, sinon-chai, and chai-jquery.

The Zepto upgrade involved involved adjustments to track two primary Zepto changes:
* Proper respect for no-cache directive, so some urls got cache-inhibiting query strings that didn't before have them
* Tracking fix of url encoding that used to fail to escaped sequences of spaces after the leader of the sequence
Fixes for both of these problems are pretty non-controversial.

The backbone upgrade involves a more controversial change. Collection fetches used to invoke reset(), but now invoke .set(). This means that neither a 'reset' nor 'complete' events are triggered.

Since the .set() takes care of all adds, we don't need to worry about the 'reset'. But we still need to trigger and respond to 'complete', so that the loading indicators are cleared. I implemented a CollectionBase which has a set that calls the underlying set, and returns the value, but triggers a 'complete' after the underlying set is done.

I originally used the new CollectionBase to implement a backwards compatibility workaround, causing the 'reset' to be triggered. Using the new set style seems much more aligned with the prevailing backbone approach, and the right way to go. The change is more substantial, though, so more eyes carefully evaluating them would be appreciated.