Skip to content

Commit

Permalink
refactor(transition): replace nested closure with static ones (vuejs#…
Browse files Browse the repository at this point in the history
  • Loading branch information
fnlctrl authored and yyx990803 committed Oct 23, 2018
1 parent af819a0 commit 88f687c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/platforms/web/runtime/components/transition.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ function isSameChild (child: VNode, oldChild: VNode): boolean {
return oldChild.key === child.key && oldChild.tag === child.tag
}

const isNotTextNode = (c: VNode) => c.tag || isAsyncPlaceholder(c)

const isVShowDirective = d => d.name === 'show'

export default {
name: 'transition',
props: transitionProps,
Expand All @@ -88,7 +92,7 @@ export default {
}

// filter out text nodes (possible whitespaces)
children = children.filter((c: VNode) => c.tag || isAsyncPlaceholder(c))
children = children.filter(isNotTextNode)
/* istanbul ignore if */
if (!children.length) {
return
Expand Down Expand Up @@ -153,7 +157,7 @@ export default {

// mark v-show
// so that the transition module can hand over the control to the directive
if (child.data.directives && child.data.directives.some(d => d.name === 'show')) {
if (child.data.directives && child.data.directives.some(isVShowDirective)) {
child.data.show = true
}

Expand Down

0 comments on commit 88f687c

Please sign in to comment.