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 || {};
// Close the `"editing"` mode, saving changes to the todo.
close: function () {
var value = this.$input.val().trim();
var trimmedValue = this.$input.val().trim();
this.$input.val(trimmedValue);
if (value) {
this.model.save({ title: value });
if (trimmedValue) {
this.model.save({ title: trimmedValue });
} else {
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