diff --git a/.changeset/beige-clocks-notice.md b/.changeset/beige-clocks-notice.md new file mode 100644 index 0000000000..be133078d4 --- /dev/null +++ b/.changeset/beige-clocks-notice.md @@ -0,0 +1,5 @@ +--- +'svelte': patch +--- + +fix: only set attribute as property if element has setter diff --git a/packages/svelte/src/internal/client/dom/elements/attributes.js b/packages/svelte/src/internal/client/dom/elements/attributes.js index 10e5c43b31..9f92c59d15 100644 --- a/packages/svelte/src/internal/client/dom/elements/attributes.js +++ b/packages/svelte/src/internal/client/dom/elements/attributes.js @@ -113,7 +113,7 @@ export function set_attribute(element, attribute, value, skip_warning) { if (value == null) { element.removeAttribute(attribute); - } else if (attribute in element && typeof value !== 'string') { + } else if (typeof value !== 'string' && get_setters(element).includes(attribute)) { // @ts-ignore element[attribute] = value; } else {