]> source.dussan.org Git - jquery-ui.git/commitdiff
Widget: Suppress disabled check when binding destroy to the remove event. Fixes ...
authorScott González <scott.gonzalez@gmail.com>
Fri, 9 Nov 2012 17:54:33 +0000 (12:54 -0500)
committerScott González <scott.gonzalez@gmail.com>
Tue, 13 Nov 2012 15:57:04 +0000 (10:57 -0500)
(cherry picked from commit 1cdeeccab0e76495842cad9d04e686aee802777d)

tests/unit/widget/widget_core.js
ui/jquery.ui.widget.js

index 9180072e3f062c792cad08028f091048452d4742..1c85898413014129c348444b957a679f57ed8057 100644 (file)
@@ -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();
index 0ad634dfdcd5323f0855cc0aafcbc5acf3bf2147..333212f0a338cf4f78d8f7c14822b7c6871a3eab 100644 (file)
@@ -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();