Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stopped component's dispose event from bubbling up #981

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/js/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -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_) {
Expand Down
7 changes: 6 additions & 1 deletion test/unit/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down