Commit 267531f5 authored by Avenger7x's avatar Avenger7x

reduce complexity

parent 63693b04
...@@ -106,12 +106,10 @@ var app = app || {}; ...@@ -106,12 +106,10 @@ var app = app || {};
// If you hit return in the main input field, create new **Todo** model, // If you hit return in the main input field, create new **Todo** model,
// persisting it to *localStorage*. // persisting it to *localStorage*.
createOnEnter: function (e) { createOnEnter: function (e) {
if (e.which !== ENTER_KEY || !this.$input.val().trim()) { if (e.which === ENTER_KEY && this.$input.val().trim()) {
return; app.todos.create(this.newAttributes());
this.$input.val('');
} }
app.todos.create(this.newAttributes());
this.$input.val('');
}, },
// Clear all completed todo items, destroying their models. // Clear all completed todo items, destroying their models.
......
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