Commit 2efa9037 authored by Addy Osmani's avatar Addy Osmani

Merge pull request #649 from passy/backbone-trimming

Backbone: trim edits
parents f7db3237 edde2237
...@@ -67,10 +67,11 @@ var app = app || {}; ...@@ -67,10 +67,11 @@ var app = app || {};
// Close the `"editing"` mode, saving changes to the todo. // Close the `"editing"` mode, saving changes to the todo.
close: function () { close: function () {
var value = this.$input.val().trim(); var trimmedValue = this.$input.val().trim();
this.$input.val(trimmedValue);
if (value) { if (trimmedValue) {
this.model.save({ title: value }); this.model.save({ title: trimmedValue });
} else { } else {
this.clear(); this.clear();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment