Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Unified Diff: sky/framework/sky-input.sky

Issue 788953006: Fix <sky-input> data binding when editing deletes the last char. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: no really. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/framework/sky-input.sky
diff --git a/sky/framework/sky-input.sky b/sky/framework/sky-input.sky
index 3bb65d967e8cb5ce020e1c23d64ba8046533069f..9ad21fb988ae688d17a1e1c1fbe22d73184a8236 100644
--- a/sky/framework/sky-input.sky
+++ b/sky/framework/sky-input.sky
@@ -28,8 +28,15 @@
module.exports = class extends SkyElement {
shadowRootReady() {
var control = this.shadowRoot.getElementById('control');
+ var text = control.firstChild;
var observer = new MutationObserver(function() {
+ // contenteditable might remove the text node, but we need to keep it
+ // since that's where the data binding is connected to.
+ if (!text.parentNode)
+ control.appendChild(text);
+ if (this.value == control.textContent)
+ return;
this.value = control.textContent;
this.dispatchEvent(new CustomEvent('change', {
bubbles: true,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698