From b05deb5fb5f34fb33e020c6487d3d935eaa38f90 Mon Sep 17 00:00:00 2001 From: Brad Dunbar Date: Wed, 18 Jan 2012 12:45:09 -0500 Subject: [PATCH] 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 87daa0dc..74becaa6 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 e1b9f87f..9ad45d27 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')); + }); + });