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

Optimize the jQuery selectors

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