mirror of https://github.com/vuejs/vue.git
refactor: extend dom-props update skip to more all keys except value
This commit is contained in:
parent
1868561442
commit
770c6ed64f
|
|
@ -38,14 +38,11 @@ function updateDOMProps (oldVnode: VNodeWithData, vnode: VNodeWithData) {
|
|||
}
|
||||
}
|
||||
|
||||
// #4521: if a click event triggers update before the change event is
|
||||
// dispatched on a checkbox/radio input, the input's checked state will
|
||||
// be reset and fail to trigger another update.
|
||||
// The root cause here is that browsers may fire microtasks in between click/change.
|
||||
// In Chrome / Firefox, click event fires before change, thus having this problem.
|
||||
// In Safari / Edge, the order is opposite.
|
||||
// Note: in Edge, if you click too fast, only the click event would fire twice.
|
||||
if (key === 'checked' && cur === oldProps[key]) {
|
||||
// skip the update if old and new VDOM state is the same.
|
||||
// the only exception is `value` where the DOM value may be temporarily
|
||||
// out of sync with VDOM state due to focus, composition and modifiers.
|
||||
// This also covers #4521 by skipping the unnecesarry `checked` update.
|
||||
if (key !== 'value' && cur === oldProps[key]) {
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue