Skip to content

Commit 1cdeecc

Browse files
committed
Widget: Suppress disabled check when binding destroy to the remove event. Fixes #8769 - Widget: ui-state-disabled blocks destroy to be triggered on remove.
1 parent d44557f commit 1cdeecc

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

tests/unit/widget/widget_core.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,6 +1197,12 @@ test( "._trigger() - instance as element", function() {
11971197
});
11981198
});
11991199

1200+
test( "auto-destroy - .remove() when disabled", function() {
1201+
shouldDestroy( true, function() {
1202+
$( "#widget" ).testWidget({ disabled: true }).remove();
1203+
});
1204+
});
1205+
12001206
test( "auto-destroy - .remove() on parent", function() {
12011207
shouldDestroy( true, function() {
12021208
$( "#widget" ).testWidget().parent().remove();

ui/jquery.ui.widget.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ $.Widget.prototype = {
232232

233233
if ( element !== this ) {
234234
$.data( element, this.widgetFullName, this );
235-
this._on( this.element, {
235+
this._on( true, this.element, {
236236
remove: function( event ) {
237237
if ( event.target === element ) {
238238
this.destroy();

0 commit comments

Comments
 (0)