diff --git a/src/js/component.js b/src/js/component.js index 4407fa8876..180c6552c1 100644 --- a/src/js/component.js +++ b/src/js/component.js @@ -72,7 +72,7 @@ vjs.Component = vjs.CoreObject.extend({ * Dispose of the component and all child components */ vjs.Component.prototype.dispose = function(){ - this.trigger('dispose'); + this.trigger({ type: 'dispose', 'bubbles': false }); // Dispose all children. if (this.children_) { diff --git a/test/unit/component.js b/test/unit/component.js index ff88ae4a5a..575d3a93d4 100644 --- a/test/unit/component.js +++ b/test/unit/component.js @@ -83,11 +83,16 @@ test('should dispose of component and children', function(){ var id = comp.el()[vjs.expando]; var hasDisposed = false; - comp.on('dispose', function(){ hasDisposed = true; }); + var bubbles = null; + comp.on('dispose', function(event){ + hasDisposed = true; + bubbles = event.bubbles; + }); comp.dispose(); ok(hasDisposed, 'component fired dispose event'); + ok(bubbles === false, 'dispose event does not bubble'); ok(!comp.children(), 'component children were deleted'); ok(!comp.el(), 'component element was deleted'); ok(!child.children(), 'child children were deleted');