Skip to content

Commit 0ad6d7a

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.
(cherry picked from commit 1cdeecc)
1 parent f8c154b commit 0ad6d7a

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
@@ -1203,6 +1203,12 @@ test( "._trigger() - instance as element", function() {
12031203
});
12041204
});
12051205

1206+
test( "auto-destroy - .remove() when disabled", function() {
1207+
shouldDestroy( true, function() {
1208+
$( "#widget" ).testWidget({ disabled: true }).remove();
1209+
});
1210+
});
1211+
12061212
test( "auto-destroy - .remove() on parent", function() {
12071213
shouldDestroy( true, function() {
12081214
$( "#widget" ).testWidget().parent().remove();

ui/jquery.ui.widget.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ $.Widget.prototype = {
237237
// TODO remove dual storage
238238
$.data( element, this.widgetName, this );
239239
$.data( element, this.widgetFullName, this );
240-
this._on( this.element, {
240+
this._on( true, this.element, {
241241
remove: function( event ) {
242242
if ( event.target === element ) {
243243
this.destroy();

0 commit comments

Comments
 (0)