Skip to content

Commit

Permalink
Merge pull request tastejs#649 from passy/backbone-trimming
Browse files Browse the repository at this point in the history
Backbone: trim edits
  • Loading branch information
addyosmani committed Aug 5, 2013
2 parents f7db323 + edde223 commit 2efa903
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions architecture-examples/backbone/js/views/todos.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit 2efa903

Please sign in to comment.