OLD | NEW |
| (Empty) |
1 <link rel="import" href="../components/polymer/polymer.html"> | |
2 | |
3 <polymer-element name="td-input" extends="input" on-keyup="{{keyupAction}}" on-k
eypress="{{keypressAction}}"> | |
4 <script> | |
5 (function() { | |
6 var ENTER_KEY = 13; | |
7 var ESC_KEY = 27; | |
8 Polymer('td-input', { | |
9 keypressAction: function(e, detail, sender) { | |
10 // Listen for enter on keypress but esc
on keyup, because | |
11 // IE doesn't fire keyup for enter. | |
12 if (e.keyCode === ENTER_KEY) { | |
13 this.fire('td-input-commit'); | |
14 } | |
15 }, | |
16 keyupAction: function(e, detail, sender) { | |
17 if (e.keyCode === ESC_KEY) { | |
18 this.fire('td-input-cancel'); | |
19 } | |
20 } | |
21 }); | |
22 })(); | |
23 </script> | |
24 </polymer-element> | |
OLD | NEW |