From 5d80203a25650ff5d3436531b8d0ab16ff7e5d78 Mon Sep 17 00:00:00 2001 From: Yuichiro Yamashita Date: Thu, 23 Feb 2023 13:52:27 +0900 Subject: [PATCH] add comment --- src/runtime/internal/dom.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/runtime/internal/dom.ts b/src/runtime/internal/dom.ts index adfdc8e3ba..11e2f43ee9 100644 --- a/src/runtime/internal/dom.ts +++ b/src/runtime/internal/dom.ts @@ -305,8 +305,17 @@ export function set_attributes(node: Element & ElementCSSInlineStyle, attributes } else if (key === '__value') { (node as any).value = node[key] = attributes[key]; } else if (descriptors[key] && descriptors[key].set) { + // For example, if an element has spread attributes, + // when a user inputs a value, spread attributes also will be updated, and it spoils the next user's input. + // So we need to skip updating if it's not changed. + // e.g. + // + // if (node[key] !== attributes[key]) { - node[key] = attributes[key]; + node[key] = attributes[key]; } } else { attr(node, key, attributes[key]);