(oldVnode, vnode)
| 5466 | /* */ |
| 5467 | |
| 5468 | function updateDOMProps (oldVnode, vnode) { |
| 5469 | if (!oldVnode.data.domProps && !vnode.data.domProps) { |
| 5470 | return |
| 5471 | } |
| 5472 | var key, cur; |
| 5473 | var elm = vnode.elm; |
| 5474 | var oldProps = oldVnode.data.domProps || {}; |
| 5475 | var props = vnode.data.domProps || {}; |
| 5476 | // clone observed objects, as the user probably wants to mutate it |
| 5477 | if (props.__ob__) { |
| 5478 | props = vnode.data.domProps = extend({}, props); |
| 5479 | } |
| 5480 | |
| 5481 | for (key in oldProps) { |
| 5482 | if (props[key] == null) { |
| 5483 | elm[key] = ''; |
| 5484 | } |
| 5485 | } |
| 5486 | for (key in props) { |
| 5487 | cur = props[key]; |
| 5488 | // ignore children if the node has textContent or innerHTML, |
| 5489 | // as these will throw away existing DOM nodes and cause removal errors |
| 5490 | // on subsequent patches (#3360) |
| 5491 | if (key === 'textContent' || key === 'innerHTML') { |
| 5492 | if (vnode.children) { vnode.children.length = 0; } |
| 5493 | if (cur === oldProps[key]) { continue } |
| 5494 | } |
| 5495 | |
| 5496 | if (key === 'value') { |
| 5497 | // store value as _value as well since |
| 5498 | // non-string values will be stringified |
| 5499 | elm._value = cur; |
| 5500 | // avoid resetting cursor position when value is the same |
| 5501 | var strCur = cur == null ? '' : String(cur); |
| 5502 | if (shouldUpdateValue(elm, vnode, strCur)) { |
| 5503 | elm.value = strCur; |
| 5504 | } |
| 5505 | } else { |
| 5506 | elm[key] = cur; |
| 5507 | } |
| 5508 | } |
| 5509 | } |
| 5510 | |
| 5511 | // check platforms/web/util/attrs.js acceptValue |
| 5512 |
nothing calls this directly
no test coverage detected