From 95a9282b20ed963a329fa4ecf9f6f96929308290 Mon Sep 17 00:00:00 2001 From: Evan You Date: Tue, 19 Apr 2016 11:07:57 -0400 Subject: [PATCH] early return in vdom update modules --- src/runtime/dom-backend/modules/attrs.js | 3 +++ src/runtime/dom-backend/modules/events.js | 3 +++ src/runtime/dom-backend/modules/props.js | 3 +++ src/runtime/dom-backend/modules/style.js | 3 +++ 4 files changed, 12 insertions(+) diff --git a/src/runtime/dom-backend/modules/attrs.js b/src/runtime/dom-backend/modules/attrs.js index a6a84d6a..d71832f4 100644 --- a/src/runtime/dom-backend/modules/attrs.js +++ b/src/runtime/dom-backend/modules/attrs.js @@ -14,6 +14,9 @@ const xlinkNS = 'http://www.w3.org/1999/xlink' const isXlink = name => name.slice(0, 6) === 'xlink:' function updateAttrs (oldVnode, vnode) { + if (!oldVnode.data.attrs && !vnode.data.attrs) { + return + } let key, cur, old const elm = vnode.elm const oldAttrs = oldVnode.data.attrs || {} diff --git a/src/runtime/dom-backend/modules/events.js b/src/runtime/dom-backend/modules/events.js index dc09e785..1db94f5d 100644 --- a/src/runtime/dom-backend/modules/events.js +++ b/src/runtime/dom-backend/modules/events.js @@ -1,6 +1,9 @@ import { updateListeners } from '../../vdom/helpers' function updateDOMListeners (oldVnode, vnode) { + if (!oldVnode.data.on && !vnode.data.on) { + return + } const on = vnode.data.on const oldOn = oldVnode.data.on || {} updateListeners(on, oldOn, (event, handler, capture) => { diff --git a/src/runtime/dom-backend/modules/props.js b/src/runtime/dom-backend/modules/props.js index fe228af9..35ac7183 100644 --- a/src/runtime/dom-backend/modules/props.js +++ b/src/runtime/dom-backend/modules/props.js @@ -1,4 +1,7 @@ function updateProps (oldVnode, vnode) { + if (!oldVnode.data.props && !vnode.data.props) { + return + } let key, cur, old const elm = vnode.elm const oldProps = oldVnode.data.props || {} diff --git a/src/runtime/dom-backend/modules/style.js b/src/runtime/dom-backend/modules/style.js index 2f9f38ed..34e7b473 100644 --- a/src/runtime/dom-backend/modules/style.js +++ b/src/runtime/dom-backend/modules/style.js @@ -29,6 +29,9 @@ function toObject (arr) { } function updateStyle (oldVnode, vnode) { + if (!oldVnode.data.style && !vnode.data.style) { + return + } let cur, name const elm = vnode.elm const oldStyle = oldVnode.data.style || {}