Skip to content
Permalink
Browse files

Widget: Fixed a problem with the .remove() proxy.

Fixes #5143 - .remove() proxy doesn't work properly.
  • Loading branch information
scottgonzalez committed Feb 6, 2010
1 parent f2a9deb commit f775b00cfa0ad662dd0e5215c9a61a210181a8d1
Showing with 10 additions and 6 deletions.
  1. +10 −6 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 ) {

0 comments on commit f775b00

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