Permalink
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.
  • Loading branch information...
1 parent d44557f commit 1cdeeccab0e76495842cad9d04e686aee802777d @scottgonzalez scottgonzalez committed Nov 9, 2012
Showing with 7 additions and 1 deletion.
  1. +6 −0 tests/unit/widget/widget_core.js
  2. +1 −1 ui/jquery.ui.widget.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();
View
@@ -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();

0 comments on commit 1cdeecc

Please sign in to comment.