Skip to content

Commit 770c6ed

Browse files
committed
refactor: extend dom-props update skip to more all keys except value
1 parent 1868561 commit 770c6ed

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/platforms/web/runtime/modules/dom-props.js

+5-8
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,11 @@ function updateDOMProps (oldVnode: VNodeWithData, vnode: VNodeWithData) {
3838
}
3939
}
4040

41-
// #4521: if a click event triggers update before the change event is
42-
// dispatched on a checkbox/radio input, the input's checked state will
43-
// be reset and fail to trigger another update.
44-
// The root cause here is that browsers may fire microtasks in between click/change.
45-
// In Chrome / Firefox, click event fires before change, thus having this problem.
46-
// In Safari / Edge, the order is opposite.
47-
// Note: in Edge, if you click too fast, only the click event would fire twice.
48-
if (key === 'checked' && cur === oldProps[key]) {
41+
// skip the update if old and new VDOM state is the same.
42+
// the only exception is `value` where the DOM value may be temporarily
43+
// out of sync with VDOM state due to focus, composition and modifiers.
44+
// This also covers #4521 by skipping the unnecesarry `checked` update.
45+
if (key !== 'value' && cur === oldProps[key]) {
4946
continue
5047
}
5148

0 commit comments

Comments
 (0)