mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Widget: Only trigger remove event if keepData is not set to true.
Fixes #5076 - Using effects kills widget instances with jQuery 1.4.
This commit is contained in:
parent
0ec857a5bd
commit
c476541251
15
ui/jquery.ui.widget.js
vendored
15
ui/jquery.ui.widget.js
vendored
@ -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();
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user