diff options
author | Scott González <scott.gonzalez@gmail.com> | 2010-02-06 02:12:41 +0000 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2010-02-06 02:12:41 +0000 |
commit | f775b00cfa0ad662dd0e5215c9a61a210181a8d1 (patch) | |
tree | 981a2ba7ae3a2295f1c6e52006913a562940cc11 /ui/jquery.ui.widget.js | |
parent | f2a9deb611332776e126cb847de4c5d577c413ef (diff) | |
download | jquery-ui-f775b00cfa0ad662dd0e5215c9a61a210181a8d1.tar.gz jquery-ui-f775b00cfa0ad662dd0e5215c9a61a210181a8d1.zip |
Widget: Fixed a problem with the .remove() proxy.
Fixes #5143 - .remove() proxy doesn't work properly.
Diffstat (limited to 'ui/jquery.ui.widget.js')
-rw-r--r-- | ui/jquery.ui.widget.js | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js index 29d09794c..49067449d 100644 --- a/ui/jquery.ui.widget.js +++ b/ui/jquery.ui.widget.js @@ -12,12 +12,16 @@ var _remove = $.fn.remove; $.fn.remove = function( selector, keepData ) { - if ( !keepData ) { - $( "*", this ).add( this ).each(function() { - $( this ).triggerHandler( "remove" ); - }); - } - return _remove.apply( this, arguments ); + return this.each(function() { + if ( !keepData ) { + if ( !selector || $.filter( selector, [ this ] ).length ) { + $( "*", this ).add( this ).each(function() { + $( this ).triggerHandler( "remove" ); + }); + } + } + return _remove.call( $(this), selector, keepData ); + }); }; $.widget = function( name, base, prototype ) { |