Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Widget: Suppress disabled check when binding destroy to the remove ev…

…ent. Fixes #8769 - Widget: ui-state-disabled blocks destroy to be triggered on remove.

(cherry picked from commit 1cdeecc)
  • Loading branch information...
commit 0ad6d7a4a9f8a96b478c527f7afc8c33439e0426 1 parent f8c154b
@scottgonzalez scottgonzalez authored
Showing with 7 additions and 1 deletion.
  1. +6 −0 tests/unit/widget/widget_core.js
  2. +1 −1  ui/jquery.ui.widget.js
View
6 tests/unit/widget/widget_core.js
@@ -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();
View
2  ui/jquery.ui.widget.js
@@ -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();
Please sign in to comment.
Something went wrong with that request. Please try again.