[Pkg-javascript-commits] [backbone] 36/74: Issue #44 -- Model#set, empty string vs null.
Jonas Smedegaard
js at moszumanska.debian.org
Sat May 3 16:59:07 UTC 2014
This is an automated email from the git hooks/post-receive script.
js pushed a commit to tag 0.3.0
in repository backbone.
commit f0ecfcd2790a9b0ec44ef64bd4e604571cd70253
Author: Jeremy Ashkenas <jashkenas at gmail.com>
Date: Mon Nov 1 10:26:44 2010 -0400
Issue #44 -- Model#set, empty string vs null.
---
backbone.js | 1 -
test/model.js | 6 ++++++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/backbone.js b/backbone.js
index 6112759..2115d2a 100644
--- a/backbone.js
+++ b/backbone.js
@@ -162,7 +162,6 @@
// Update attributes.
for (var attr in attrs) {
var val = attrs[attr];
- if (val === '') val = null;
if (!_.isEqual(now[attr], val)) {
now[attr] = val;
if (!options.silent) {
diff --git a/test/model.js b/test/model.js
index dff0196..9160f07 100644
--- a/test/model.js
+++ b/test/model.js
@@ -96,6 +96,12 @@ $(document).ready(function() {
ok(changeCount == 2, "Change count should have incremented for unset.");
});
+ test("Model: set an empty string", function() {
+ var model = new Backbone.Model({name : "Model"});
+ model.set({name : ''});
+ equals(model.get('name'), '');
+ });
+
test("Model: changed, hasChanged, changedAttributes, previous, previousAttributes", function() {
var model = new Backbone.Model({name : "Tim", age : 10});
model.bind('change', function() {
--
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