Skip to content

Commit e22b916

Browse files
committed
fix: only set attribute as property if element has setter
1 parent 78b134d commit e22b916

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.changeset/beige-clocks-notice.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: only set attribute as property if element has setter

packages/svelte/src/internal/client/dom/elements/attributes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export function set_attribute(element, attribute, value, skip_warning) {
113113

114114
if (value == null) {
115115
element.removeAttribute(attribute);
116-
} else if (attribute in element && typeof value !== 'string') {
116+
} else if (typeof value !== 'string' && get_setters(element).includes(attribute)) {
117117
// @ts-ignore
118118
element[attribute] = value;
119119
} else {

0 commit comments

Comments
 (0)