Skip to content
Permalink
Browse files

Widget: Only trigger remove event if keepData is not set to true.

Fixes #5076 - Using effects kills widget instances with jQuery 1.4.
  • Loading branch information
scottgonzalez committed Jan 19, 2010
1 parent 0ec857a commit c476541251f1b232ab9ac274b99a96c2b0848b6b
Showing with 8 additions and 7 deletions.
  1. +8 −7 ui/jquery.ui.widget.js
@@ -11,12 +11,12 @@

var _remove = $.fn.remove;

$.fn.remove = function() {
// Safari has a native remove event which actually removes DOM elements,
// so we have to use triggerHandler instead of trigger (#3037).
$( "*", this ).add( this ).each(function() {
$( this ).triggerHandler( "remove" );
});
$.fn.remove = function( selector, keepData ) {
if ( !keepData ) {
$( "*", this ).add( this ).each(function() {
$( this ).triggerHandler( "remove" );
});
}
return _remove.apply( this, arguments );
};

@@ -132,7 +132,8 @@ $.Widget.prototype = {
options );

var self = this;
this.element.bind( "remove." + this.widgetName, function() {
this.element.bind( "remove." + this.widgetName, function(event) {
console.log('remove', event);
self.destroy();
});

0 comments on commit c476541

Please sign in to comment.
You can’t perform that action at this time.