mirror of
https://github.com/jashkenas/backbone.git
synced 2026-04-30 03:00:06 -04:00
Revert set/save argument juggling
This commit is contained in:
12
backbone.js
12
backbone.js
@@ -295,11 +295,11 @@
|
||||
if (key == null) return this;
|
||||
|
||||
// Handle both `"key", value` and `{key: value}` -style arguments.
|
||||
if (typeof key === 'string') {
|
||||
(attrs = {})[key] = val;
|
||||
} else {
|
||||
if (typeof key === 'object') {
|
||||
attrs = key;
|
||||
options = val;
|
||||
} else {
|
||||
(attrs = {})[key] = val;
|
||||
}
|
||||
|
||||
options || (options = {});
|
||||
@@ -434,11 +434,11 @@
|
||||
var attrs, model, success, method, xhr, attributes = this.attributes;
|
||||
|
||||
// Handle both `"key", value` and `{key: value}` -style arguments.
|
||||
if (typeof key === 'string') {
|
||||
(attrs = {})[key] = val;
|
||||
} else {
|
||||
if (key == null || typeof key === 'object') {
|
||||
attrs = key;
|
||||
options = val;
|
||||
} else {
|
||||
(attrs = {})[key] = val;
|
||||
}
|
||||
|
||||
// If we're not waiting and attributes exist, save acts as `set(attr).save(null, opts)`.
|
||||
|
||||
Reference in New Issue
Block a user