From 6ef8137b4b6162878c1034e09a8ee0f0e730e119 Mon Sep 17 00:00:00 2001 From: Jacob Wright Date: Wed, 3 Apr 2019 11:16:34 -0600 Subject: [PATCH] Update text.data only when necessary Only update the text node if the text node's value is not equal. This fix is for contenteditable usage where text content may change outside of Svelte's control in order to preserve text composition. Accomplishes the same thing as #2341 without the added API. --- src/internal/dom.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/internal/dom.js b/src/internal/dom.js index 2d661b5958..e7b32f5798 100644 --- a/src/internal/dom.js +++ b/src/internal/dom.js @@ -154,7 +154,7 @@ export function claim_text(nodes, data) { } export function set_data(text, data) { - text.data = '' + data; + if (text.data !== '' + data) text.data = '' + data; } export function set_input_type(input, type) {