diff options
author | Scott González <scott.gonzalez@gmail.com> | 2012-11-09 12:54:33 -0500 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2012-11-13 10:57:04 -0500 |
commit | 0ad6d7a4a9f8a96b478c527f7afc8c33439e0426 (patch) | |
tree | bead4585459cb4f7da32dbe02b69c17107bbf8a2 | |
parent | f8c154b4d2900d0b801af7c6576401cc962057b8 (diff) | |
download | jquery-ui-0ad6d7a4a9f8a96b478c527f7afc8c33439e0426.tar.gz jquery-ui-0ad6d7a4a9f8a96b478c527f7afc8c33439e0426.zip |
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 1cdeeccab0e76495842cad9d04e686aee802777d)
-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 9180072e3..1c8589841 100644 --- a/tests/unit/widget/widget_core.js +++ b/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(); diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js index 0ad634dfd..333212f0a 100644 --- a/ui/jquery.ui.widget.js +++ b/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(); |