(oldVnode, vnode)
| 5137 | } |
| 5138 | |
| 5139 | function _update (oldVnode, vnode) { |
| 5140 | var isCreate = oldVnode === emptyNode; |
| 5141 | var isDestroy = vnode === emptyNode; |
| 5142 | var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context); |
| 5143 | var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context); |
| 5144 | |
| 5145 | var dirsWithInsert = []; |
| 5146 | var dirsWithPostpatch = []; |
| 5147 | |
| 5148 | var key, oldDir, dir; |
| 5149 | for (key in newDirs) { |
| 5150 | oldDir = oldDirs[key]; |
| 5151 | dir = newDirs[key]; |
| 5152 | if (!oldDir) { |
| 5153 | // new directive, bind |
| 5154 | callHook$1(dir, 'bind', vnode, oldVnode); |
| 5155 | if (dir.def && dir.def.inserted) { |
| 5156 | dirsWithInsert.push(dir); |
| 5157 | } |
| 5158 | } else { |
| 5159 | // existing directive, update |
| 5160 | dir.oldValue = oldDir.value; |
| 5161 | callHook$1(dir, 'update', vnode, oldVnode); |
| 5162 | if (dir.def && dir.def.componentUpdated) { |
| 5163 | dirsWithPostpatch.push(dir); |
| 5164 | } |
| 5165 | } |
| 5166 | } |
| 5167 | |
| 5168 | if (dirsWithInsert.length) { |
| 5169 | var callInsert = function () { |
| 5170 | for (var i = 0; i < dirsWithInsert.length; i++) { |
| 5171 | callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode); |
| 5172 | } |
| 5173 | }; |
| 5174 | if (isCreate) { |
| 5175 | mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'insert', callInsert); |
| 5176 | } else { |
| 5177 | callInsert(); |
| 5178 | } |
| 5179 | } |
| 5180 | |
| 5181 | if (dirsWithPostpatch.length) { |
| 5182 | mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'postpatch', function () { |
| 5183 | for (var i = 0; i < dirsWithPostpatch.length; i++) { |
| 5184 | callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode); |
| 5185 | } |
| 5186 | }); |
| 5187 | } |
| 5188 | |
| 5189 | if (!isCreate) { |
| 5190 | for (key in oldDirs) { |
| 5191 | if (!newDirs[key]) { |
| 5192 | // no longer present, unbind |
| 5193 | callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy); |
| 5194 | } |
| 5195 | } |
| 5196 | } |
no test coverage detected