Skip to content

Commit

Permalink
fix(core): only unset dom prop when not present
Browse files Browse the repository at this point in the history
fix #9650
  • Loading branch information
yyx990803 committed Mar 20, 2019
1 parent 02d21c2 commit f11449d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/platforms/web/runtime/modules/dom-props.js
Expand Up @@ -19,10 +19,11 @@ function updateDOMProps (oldVnode: VNodeWithData, vnode: VNodeWithData) {
}

for (key in oldProps) {
if (isUndef(props[key])) {
if (!(key in props)) {

This comment has been minimized.

Copy link
@Siegrift

Siegrift Sep 5, 2019

@yyx990803 can you please tell when is this piece of code run? If I try to render the following piece of code inside vue template

<div v-html="hideInnerHtml ? undefined: safeHtml"></div>

the key is still present in props and has value '' (empty string).
Also, shouldn't you just iterate over own properties and not through the whole prototype chain?

elm[key] = ''
}
}

for (key in props) {
cur = props[key]
// ignore children if the node has textContent or innerHTML,
Expand Down

0 comments on commit f11449d

Please sign in to comment.