diff options
author | Scott González <scott.gonzalez@gmail.com> | 2010-01-19 04:11:33 +0000 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2010-01-19 04:11:33 +0000 |
commit | c476541251f1b232ab9ac274b99a96c2b0848b6b (patch) | |
tree | ad7ad4c2fb7f785562048f40782810689f38d691 /ui/jquery.ui.widget.js | |
parent | 0ec857a5bd1df6cf210dbaa75e5085caa0d0aff0 (diff) | |
download | jquery-ui-c476541251f1b232ab9ac274b99a96c2b0848b6b.tar.gz jquery-ui-c476541251f1b232ab9ac274b99a96c2b0848b6b.zip |
Widget: Only trigger remove event if keepData is not set to true.
Fixes #5076 - Using effects kills widget instances with jQuery 1.4.
Diffstat (limited to 'ui/jquery.ui.widget.js')
-rw-r--r-- | ui/jquery.ui.widget.js | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js index fe21364fe..976bd9afd 100644 --- a/ui/jquery.ui.widget.js +++ b/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(); }); |