superfeedr / indexeddb-backbonejs-adapter

An indexedDB adapter for Backbonejs
http://blog.superfeedr.com/indexeddb-backbonejs-adapter/
MIT License
248 stars 61 forks source link

Regression: jQuery's Deferred should be optionally fulfilled by Backbone.$.Deferred #76

Closed andornaut closed 9 years ago

andornaut commented 9 years ago

The sync() method gets a reference to the Deferred function in two different places. First, it gets it from Backbone.$.Deferred; and then a few lines later, it gets it from $.Deferred.

The latter isn't ideal, because a global "$" object may not be present (in an AMD, node, etc environment), whereas if jQuery is present, then Backbone will make it available as Backbone.$. Earlier versions of this library used the following test, which handles this case better:

if (typeof Backbone.$ === 'undefined' || typeof Backbone.$.Deferred === 'undefined') {

Also, since there is now no test for the presence of Backbone.$.Deferred before calling it, there is a new dependency on $.Deferred, where it was optional prior to this changeset.