Commit 625eda44 authored by Sindre Sorhus's avatar Sindre Sorhus

Optimize the jQuery selectors

parent 654a82ce
......@@ -31,7 +31,7 @@
{{#this}}
<li class="item {{#if done}}done{{/if}}" data-id="{{id}}">
<div class="view" title="Double click to edit...">
<input type="checkbox" {{#if done}}checked="checked"{{/if}}>
<input class="toggle" type="checkbox" {{#if done}}checked="checked"{{/if}}>
<span>{{title}}</span>
<a class="destroy"></a>
</div>
......
......@@ -53,10 +53,10 @@ jQuery(function($) {
list = this.$todoList;
app.on( 'click', '.clear', this.destroyDone );
app.on( 'submit', 'form', this.create );
list.on( 'change', 'input[type="checkbox"]', this.toggle );
list.on( 'change', '.toggle', this.toggle );
list.on( 'dblclick', '.view', this.edit );
list.on( 'keypress', 'input[type="text"]', this.blurOnEnter );
list.on( 'blur', 'input[type="text"]', this.update );
list.on( 'keypress', '.edit input', this.blurOnEnter );
list.on( 'blur', '.edit input', this.update );
list.on( 'click', '.destroy', this.destroy );
},
render: function() {
......
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