[Pkg-javascript-commits] [backbone] 229/281: fix #871 - calling set with 'attributes' property
Jonas Smedegaard
js at moszumanska.debian.org
Sat May 3 17:02:16 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 b05deb5fb5f34fb33e020c6487d3d935eaa38f90
Author: Brad Dunbar <dunbarb2 at gmail.com>
Date: Wed Jan 18 12:45:09 2012 -0500
fix #871 - calling set with 'attributes' property
---
backbone.js | 2 +-
test/model.js | 6 ++++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/backbone.js b/backbone.js
index 87daa0d..74becaa 100644
--- a/backbone.js
+++ b/backbone.js
@@ -220,7 +220,7 @@
// Extract attributes and options.
options || (options = {});
if (!attrs) return this;
- if (attrs.attributes) attrs = attrs.attributes;
+ if (attrs instanceof Backbone.Model) attrs = attrs.attributes;
if (options.unset) for (var attr in attrs) attrs[attr] = void 0;
var now = this.attributes, escaped = this._escapedAttributes;
diff --git a/test/model.js b/test/model.js
index e1b9f87..9ad45d2 100644
--- a/test/model.js
+++ b/test/model.js
@@ -531,4 +531,10 @@ $(document).ready(function() {
model.set({a: 'a', b: 'b', c: 'c'});
});
+ test("#871, set with attributes property", function() {
+ var model = new Backbone.Model();
+ model.set({attributes: true});
+ ok(model.has('attributes'));
+ });
+
});
--
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