[Pkg-javascript-commits] [backbone] 193/281: fixes #651 -- always clone options.
Jonas Smedegaard
js at moszumanska.debian.org
Sat May 3 17:02:11 UTC 2014
This is an automated email from the git hooks/post-receive script.
js pushed a commit to tag 0.9.0
in repository backbone.
commit b28a24207aa668d579c09515031ea2cf152d4009
Author: Jeremy Ashkenas <jashkenas at gmail.com>
Date: Fri Jan 13 14:30:43 2012 -0500
fixes #651 -- always clone options.
---
backbone.js | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/backbone.js b/backbone.js
index 3bd4b48..72d5e9d 100644
--- a/backbone.js
+++ b/backbone.js
@@ -252,7 +252,7 @@
// model differs from its current attributes, they will be overriden,
// triggering a `"change"` event.
fetch : function(options) {
- options || (options = {});
+ options = options ? _.clone(options) : {};
var model = this;
var success = options.success;
options.success = function(resp, status, xhr) {
@@ -267,7 +267,7 @@
// If the server returns an attributes hash that differs, the model's
// state will be `set` again.
save : function(attrs, options) {
- options || (options = {});
+ options = options ? _.clone(options) : {};
if (attrs && !this.set(attrs, options)) return false;
var model = this;
var success = options.success;
@@ -287,7 +287,7 @@
// Destroy this model on the server if it was already persisted.
// Upon success, the model is removed from its collection, if it has one.
destroy : function(options) {
- options || (options = {});
+ options = options ? _.clone(options) : {};
if (this.isNew()) return this.trigger('destroy', this, this.collection, options);
var model = this;
var success = options.success;
@@ -525,7 +525,7 @@
// collection when they arrive. If `add: true` is passed, appends the
// models to the collection instead of resetting.
fetch : function(options) {
- options || (options = {});
+ options = options ? _.clone(options) : {};
if (options.parse === undefined) options.parse = true;
var collection = this;
var success = options.success;
@@ -542,7 +542,7 @@
// Returns the model, or 'false' if validation on a new model fails.
create : function(model, options) {
var coll = this;
- options || (options = {});
+ options = options ? _.clone(options) : {};
model = this._prepareModel(model, options);
if (!model) return false;
var success = options.success;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/backbone.git
More information about the Pkg-javascript-commits
mailing list