Skip to content

Commit e4fd632

Browse files
committed
avoid resetting innerHTML/textContent if value is the same (fix vuejs#4247)
1 parent c1bf20a commit e4fd632

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,14 @@ function updateDOMProps (oldVnode: VNodeWithData, vnode: VNodeWithData) {
2121
}
2222
}
2323
for (key in props) {
24+
cur = props[key]
2425
// ignore children if the node has textContent or innerHTML,
2526
// as these will throw away existing DOM nodes and cause removal errors
2627
// on subsequent patches (#3360)
27-
if ((key === 'textContent' || key === 'innerHTML') && vnode.children) {
28-
vnode.children.length = 0
28+
if (key === 'textContent' || key === 'innerHTML') {
29+
if (vnode.children) vnode.children.length = 0
30+
if (cur === oldProps[key]) continue
2931
}
30-
cur = props[key]
3132
if (key === 'value') {
3233
// store value as _value as well since
3334
// non-string values will be stringified

0 commit comments

Comments
 (0)