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