Skip to content

Commit 66cc576

Browse files
committed
fix: if dispatchEvent dispatch if value empty or oldValue = newValue
1 parent afb8c89 commit 66cc576

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/setValue.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ HTMLHeadingElement.prototype.setValue = function (value, dispatch) {
1414

1515
// TODO: check if using a a switch case will provide better performance
1616
const setValue = (el, value, dispatch) => {
17-
let valueDispatch = el.getAttribute("value-dispatch");
17+
let valueDispatch = el.hasAttribute("value-dispatch");
1818
if (
1919
(valueDispatch || valueDispatch === "") &&
2020
(value === "$false" || value === undefined || value === null)
@@ -96,7 +96,9 @@ const setValue = (el, value, dispatch) => {
9696
}
9797
}
9898
} else {
99-
if (el.value === value) return;
99+
if (el.value === value && !valueDispatch) {
100+
return;
101+
}
100102

101103
el.value = value;
102104
}

0 commit comments

Comments
 (0)