diff --git a/src/platforms/web/runtime/components/transition.js b/src/platforms/web/runtime/components/transition.js index 84fe82984a1..171ea28ca32 100644 --- a/src/platforms/web/runtime/components/transition.js +++ b/src/platforms/web/runtime/components/transition.js @@ -40,6 +40,11 @@ function getRealChild (vnode: ?VNode): ?VNode { } } +function activeAttr (k: string): boolean { + // assuming active if undefined + return this[camelize(k)] === undefined || this[camelize(k)] === true +} + export function extractTransitionData (comp: Component): Object { const data = {} const options: ComponentOptions = comp.$options @@ -49,9 +54,11 @@ export function extractTransitionData (comp: Component): Object { } // events. // extract listeners and pass them directly to the transition methods - const listeners: ?Object = options._parentListeners - for (const key in listeners) { - data[camelize(key)] = listeners[key] + const listeners: Object = options._parentListeners || {} + // remove the listeners that are explicitily disabled + const listenerKeys: Array = Object.keys(listeners).filter(activeAttr, data) + for (let i = 0; i < listenerKeys.length; i++) { + data[camelize(listenerKeys[i])] = listeners[listenerKeys[i]] } return data } diff --git a/test/unit/features/transition/transition.spec.js b/test/unit/features/transition/transition.spec.js index 2ecf80b854d..888fb28f4b3 100644 --- a/test/unit/features/transition/transition.spec.js +++ b/test/unit/features/transition/transition.spec.js @@ -769,6 +769,30 @@ if (!isIE9) { }).then(done) }) + it('appear: false', done => { + let next + const vm = new Vue({ + template: ` +
+ +
foo
+
+
+ `, + data: { ok: true }, + methods: { + appear: (el, cb) => { + next = cb + } + } + }).$mount(el) + + waitForUpdate(() => { + expect(vm.$el.children[0].className).toBe('test') + expect(next).toBeUndefined() + }).then(done) + }) + it('transition on SVG elements', done => { const vm = new Vue({ template: `