Skip to content
Permalink
Browse files

Widget: Destroy only when element is the actual target. Fixes #8652 -…

… Widget: Destroy only when element is the actual target.
  • Loading branch information
marcandre authored and scottgonzalez committed Oct 23, 2012
1 parent b1b07e8 commit 8bb05d23e2c49ecbe2f83a3552efb0a93c48bb85
Showing with 14 additions and 1 deletion.
  1. +7 −0 tests/unit/widget/widget_core.js
  2. +7 −1 ui/jquery.ui.widget.js
@@ -1167,6 +1167,13 @@ test( "._trigger() - instance as element", function() {
$( "#widget" ).testWidget().detach();
});
});

test( "destroy - remove event bubbling", function() {
shouldDestroy( false, function() {
$( "<div>child</div>" ).appendTo( $( "#widget" ).testWidget() )
.trigger( "remove" );
});
});
}());

test( "redefine", function() {
@@ -237,7 +237,13 @@ $.Widget.prototype = {
// TODO remove dual storage
$.data( element, this.widgetName, this );
$.data( element, this.widgetFullName, this );
this._on({ remove: "destroy" });
this._on({
remove: function( event ) {
if ( event.target === element ) {
this.destroy();
}
}
});
this.document = $( element.style ?
// element within the document
element.ownerDocument :

6 comments on commit 8bb05d2

@jzaefferer

This comment has been minimized.

Copy link
Member

@jzaefferer jzaefferer replied Nov 26, 2012

@marcandre Marc, could you sign our CLA? http://jquery.github.com/cla.html Thanks.

@marcandre

This comment has been minimized.

Copy link
Contributor Author

@marcandre marcandre replied Nov 26, 2012

Already did a month ago (#736 (comment) )

@jzaefferer

This comment has been minimized.

Copy link
Member

@jzaefferer jzaefferer replied Nov 27, 2012

I looked for "Marc-Andre Lafortune" (and parts of that) and can't find you in our list. @scottgonzalez am I missing something?

@scottgonzalez

This comment has been minimized.

Copy link
Member

@scottgonzalez scottgonzalez replied Nov 27, 2012

That sure is strange. I'm sure I would've waited for the CLA to come through, and Marc seems to remember signing it, but I don't see it in the list. @marcandre Would you mind signing it again? I'm not sure why the previous submission isn't showing up for us.

@marcandre

This comment has been minimized.

Copy link
Contributor Author

@marcandre marcandre replied Nov 27, 2012

Done.

@scottgonzalez

This comment has been minimized.

Copy link
Member

@scottgonzalez scottgonzalez replied Nov 27, 2012

Thanks. Sorry about the need to sign twice.

Please sign in to comment.
You can’t perform that action at this time.