Skip to content
This repository was archived by the owner on Mar 13, 2018. It is now read-only.

Commit 190083a

Browse files
committed
Remove a few hacks from td-item
- Remove workarounds for Polymer/polymer#186 - Platform.flush is automatic with asyncMethod
1 parent 43c9f69 commit 190083a

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

elements/td-item.html

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,38 +7,27 @@
77
<label>{{item.title}}</label>
88
<button class="destroy" on-click="destroyAction"></button>
99
</div>
10-
<input is="td-input" id="edit" class="edit" value="{{title}}" hidden?="{{!editing}}" on-td-input-commit="commitAction" on-td-input-cancel="cancelAction">
10+
<input is="td-input" id="edit" class="edit" value="{{item.title}}" hidden?="{{!editing}}" on-td-input-commit="commitAction" on-td-input-cancel="cancelAction">
1111
</template>
1212
<script>
1313
(function() {
14-
var ENTER_KEY = 13;
15-
var ESC_KEY = 27;
1614
Polymer('td-item', {
1715
editing: false,
1816
editAction: function() {
1917
this.editing = true;
20-
// FIXME: Custom elements extended from <input> don't have
21-
// <input> binding behavior.
22-
// https://github.com/Polymer/polymer/issues/186
23-
this.$.edit.value = this.title = this.item.title;
2418
// schedule focus for the end of microtask, when the input will be visible
25-
Platform.flush();
2619
this.asyncMethod(function() {
2720
this.$.edit.focus();
2821
});
2922
},
3023
commitAction: function() {
31-
// FIXME: Custom elements extended from <input> don't have
32-
// <input> binding behavior.
33-
// https://github.com/Polymer/polymer/issues/186
34-
this.title = this.$.edit.value;
3524
if (this.editing) {
3625
this.editing = false;
37-
this.item.title = this.title.trim();
26+
this.item.title = this.item.title.trim();
3827
if (this.item.title === '') {
3928
this.destroyAction();
4029
}
41-
this.fire('td-item-changed');
30+
this.fire('td-item-changed');
4231
}
4332
},
4433
cancelAction: function() {

0 commit comments

Comments
 (0)