diff options
-rw-r--r-- | tests/unit/widget/widget_core.js | 6 | ||||
-rw-r--r-- | ui/jquery.ui.widget.js | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/tests/unit/widget/widget_core.js b/tests/unit/widget/widget_core.js index b0812638a..418cc4d39 100644 --- a/tests/unit/widget/widget_core.js +++ b/tests/unit/widget/widget_core.js @@ -1197,6 +1197,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(); diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js index 65ac155ae..02f89bc98 100644 --- a/ui/jquery.ui.widget.js +++ b/ui/jquery.ui.widget.js @@ -232,7 +232,7 @@ $.Widget.prototype = { if ( element !== this ) { $.data( element, this.widgetFullName, this ); - this._on( this.element, { + this._on( true, this.element, { remove: function( event ) { if ( event.target === element ) { this.destroy(); |