Index: samples/third_party/todomvc/web/editable_label.dart |
diff --git a/samples/third_party/todomvc/web/editable_label.dart b/samples/third_party/todomvc/web/editable_label.dart |
index af8abba96b2baaf5ad453a6eab3e7453e25cc3d4..b6338330218731e6898b3631b8efec25df3f9932 100644 |
--- a/samples/third_party/todomvc/web/editable_label.dart |
+++ b/samples/third_party/todomvc/web/editable_label.dart |
@@ -25,19 +25,21 @@ class EditableLabel extends PolymerElement { |
bool get applyAuthorStyles => true; |
- InputElement get _editBox => getShadowRoot("editable-label").query('#edit'); |
+ ShadowRoot get _shadowRoot => getShadowRoot('editable-label'); |
+ |
+ InputElement get _editBox => _shadowRoot.query('#edit'); |
void edit() { |
editing = true; |
- // This causes _editBox to be inserted. |
- performMicrotaskCheckpoint(); |
- |
- // For IE and Firefox: use .focus(), then reset the value to move the |
- // cursor to the end. |
- _editBox.focus(); |
- _editBox.value = ''; |
- _editBox.value = value; |
+ // Wait for _editBox to be inserted. |
+ onMutation(_shadowRoot, (_) { |
+ // For IE and Firefox: use .focus(), then reset the value to move the |
+ // cursor to the end. |
+ _editBox.focus(); |
+ _editBox.value = ''; |
+ _editBox.value = value; |
+ }); |
} |
void update(Event e) { |