mirror of
https://github.com/jashkenas/backbone.git
synced 2026-01-14 17:37:54 -05:00
using typeof rather than _.isObject for model.save
This commit is contained in:
@@ -461,7 +461,7 @@
|
||||
model.attributes = attributes;
|
||||
var serverAttrs = model.parse(resp, options);
|
||||
if (options.wait) serverAttrs = _.extend(attrs || {}, serverAttrs);
|
||||
if (_.isObject(serverAttrs) && !model.set(serverAttrs, options)) {
|
||||
if (typeof serverAttrs === 'object' && !model.set(serverAttrs, options)) {
|
||||
return false;
|
||||
}
|
||||
if (success) success(model, resp, options);
|
||||
|
||||
@@ -423,10 +423,11 @@ $(document).ready(function() {
|
||||
equal(model.get('title'), 'Twelfth Night');
|
||||
});
|
||||
|
||||
test("save with non-object success response", 1, function () {
|
||||
test("save with non-object success response", 2, function () {
|
||||
var model = new Backbone.Model();
|
||||
model.sync = function(method, model, options) {
|
||||
options.success(model, '', options);
|
||||
options.success(model, null, options);
|
||||
};
|
||||
model.save({testing:'empty'}, {
|
||||
success: function (model) {
|
||||
|
||||
Reference in New Issue
Block a user