Skip to content

Commit ee8538d

Browse files
committed
fix: if value is the same do not set
1 parent bdc6e8a commit ee8538d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/setValue.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ HTMLHeadingElement.prototype.setValue = function (value) {
1515

1616
// TODO: check if using a a switch case will provide better performance
1717
const setValue = (el, value) => {
18-
1918
if (value === null || value === undefined) return;
2019
if (el.hasAttribute('component') || el.hasAttribute('plugin'))
2120
return storage.set(el, value)
@@ -73,9 +72,12 @@ const setValue = (el, value) => {
7372
options[i].selected = "";
7473
}
7574
}
76-
} else
77-
el.value = value;
75+
} else {
76+
if (el.value === value)
77+
return
7878

79+
el.value = value;
80+
}
7981
dispatchEvents(el)
8082
} else if (el.tagName === 'IMG' || el.tagName === 'SOURCE') {
8183
el.src = value;

0 commit comments

Comments
 (0)