Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Widget: Wrap the remove event trigerring in a try/catch. Fixes #7510 …
…- jQuery.data throws a script error in certain circumstances.
  • Loading branch information
scottgonzalez committed Aug 9, 2011
1 parent 1b5af10 commit c7c5b6b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions ui/jquery.ui.widget.js
Expand Up @@ -14,7 +14,10 @@ if ( $.cleanData ) {
var _cleanData = $.cleanData; var _cleanData = $.cleanData;
$.cleanData = function( elems ) { $.cleanData = function( elems ) {
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
$( elem ).triggerHandler( "remove" ); try {
$( elem ).triggerHandler( "remove" );
// http://bugs.jquery.com/ticket/8235
} catch( e ) {}
} }
_cleanData( elems ); _cleanData( elems );
}; };
Expand All @@ -25,7 +28,10 @@ if ( $.cleanData ) {
if ( !keepData ) { if ( !keepData ) {
if ( !selector || $.filter( selector, [ this ] ).length ) { if ( !selector || $.filter( selector, [ this ] ).length ) {
$( "*", this ).add( [ this ] ).each(function() { $( "*", this ).add( [ this ] ).each(function() {
$( this ).triggerHandler( "remove" ); try {
$( this ).triggerHandler( "remove" );
// http://bugs.jquery.com/ticket/8235
} catch( e ) {}
}); });
} }
} }
Expand Down

0 comments on commit c7c5b6b

Please sign in to comment.