Commit 5ff915aa authored by Sindre Sorhus's avatar Sindre Sorhus

Merge pull request #1168 from samccone/sjs/fix-escape-behavior

Fix spec compliance for Marionette.
parents f7ece0f5 ca2b6620
......@@ -14,7 +14,18 @@ TodoMVC.module('Layout', function (Layout, App, Backbone) {
},
events: {
'keypress @ui.input': 'onInputKeypress'
'keypress @ui.input': 'onInputKeypress',
'keyup @ui.input': 'onInputKeyup'
},
// According to the spec
// If escape is pressed during the edit, the edit state should be left and any changes be discarded.
onInputKeyup: function (e) {
var ESC_KEY = 27;
if (e.which === ESC_KEY) {
this.render();
}
},
onInputKeypress: function (e) {
......
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