Replace x instanceof Array with Array.isArray(x)

This commit is contained in:
Barney Carroll 2016-11-24 09:21:27 +00:00
parent 106a9720d1
commit d82d337569
10 changed files with 32 additions and 34 deletions

View file

@ -135,7 +135,7 @@ module.exports = function($window) {
else {
var recycling = isRecyclable(old, vnodes)
if (recycling) old = old.concat(old.pool)
var oldStart = 0, start = 0, oldEnd = old.length - 1, end = vnodes.length - 1, map
while (oldEnd >= oldStart && end >= start) {
var o = old[oldStart], v = vnodes[start]
@ -410,7 +410,7 @@ module.exports = function($window) {
if (vnode.instance != null) onremove(vnode.instance)
else {
var children = vnode.children
if (children instanceof Array) {
if (Array.isArray(children)) {
for (var i = 0; i < children.length; i++) {
var child = children[i]
if (child != null) onremove(child)
@ -559,7 +559,7 @@ module.exports = function($window) {
// First time rendering into a node clears it out
if (dom.vnodes == null) dom.textContent = ""
if (!(vnodes instanceof Array)) vnodes = [vnodes]
if (!Array.isArray(vnodes)) vnodes = [vnodes]
updateNodes(dom, dom.vnodes, Vnode.normalizeChildren(vnodes), hooks, null, undefined)
dom.vnodes = vnodes
for (var i = 0; i < hooks.length; i++) hooks[i]()