Skip to content

Commit cd3d202

Browse files
committed
refactor: simplify conditions
1 parent 7ec4627 commit cd3d202

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

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

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

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]) {
46-
continue
47-
}
48-
4941
if (key === 'value') {
5042
// store value as _value as well since
5143
// non-string values will be stringified
@@ -66,7 +58,13 @@ function updateDOMProps (oldVnode: VNodeWithData, vnode: VNodeWithData) {
6658
while (svg.firstChild) {
6759
elm.appendChild(svg.firstChild)
6860
}
69-
} else {
61+
} else if (
62+
// skip the update if old and new VDOM state is the same.
63+
// `value` is handled separately because the DOM value may be temporarily
64+
// out of sync with VDOM state due to focus, composition and modifiers.
65+
// This #4521 by skipping the unnecesarry `checked` update.
66+
cur !== oldProps[key]
67+
) {
7068
elm[key] = cur
7169
}
7270
}

0 commit comments

Comments
 (0)