Skip to content

Commit

Permalink
Widget: Suppress disabled check when binding destroy to the remove ev…
Browse files Browse the repository at this point in the history
…ent. Fixes #8769 - Widget: ui-state-disabled blocks destroy to be triggered on remove.

(cherry picked from commit 1cdeecc)
  • Loading branch information
scottgonzalez committed Nov 13, 2012
1 parent f8c154b commit 0ad6d7a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions tests/unit/widget/widget_core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1203,6 +1203,12 @@ test( "._trigger() - instance as element", function() {
});
});

test( "auto-destroy - .remove() when disabled", function() {
shouldDestroy( true, function() {
$( "#widget" ).testWidget({ disabled: true }).remove();
});
});

test( "auto-destroy - .remove() on parent", function() {
shouldDestroy( true, function() {
$( "#widget" ).testWidget().parent().remove();
Expand Down
2 changes: 1 addition & 1 deletion ui/jquery.ui.widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ $.Widget.prototype = {
// TODO remove dual storage
$.data( element, this.widgetName, this );
$.data( element, this.widgetFullName, this );
this._on( this.element, {
this._on( true, this.element, {
remove: function( event ) {
if ( event.target === element ) {
this.destroy();
Expand Down

0 comments on commit 0ad6d7a

Please sign in to comment.