Skip to content

Commit

Permalink
Don’t preserve dirty input values if the names changed
Browse files Browse the repository at this point in the history
  • Loading branch information
joeldrapper committed Mar 5, 2024
1 parent 332ad3e commit 337c705
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dist/morphlex.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/morphlex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ class Morph {
if (
element.type !== "file" &&
!(this.#options.ignoreActiveValue && document.activeElement === element) &&
!(this.#options.preserveModifiedValues && element.value !== element.defaultValue)
!(this.#options.preserveModifiedValues && element.name === ref.name && element.value !== element.defaultValue)
)
this.#updateProperty(element, "value", ref.value);
} else if (isOption(element) && isOption(ref)) this.#updateProperty(element, "selected", ref.selected);
Expand Down

0 comments on commit 337c705

Please sign in to comment.