Removed uses of arguments.callee from jQuery.

This commit is contained in:
John Resig 2009-12-07 16:42:25 -08:00
parent 00a0abb751
commit 98ce35d52b
2 changed files with 11 additions and 9 deletions

View file

@ -373,8 +373,8 @@ jQuery.extend({
// Mozilla, Opera and webkit nightlies currently support this event // Mozilla, Opera and webkit nightlies currently support this event
if ( document.addEventListener ) { if ( document.addEventListener ) {
// Use the handy event callback // Use the handy event callback
document.addEventListener( "DOMContentLoaded", function() { document.addEventListener( "DOMContentLoaded", function DOMContentLoaded() {
document.removeEventListener( "DOMContentLoaded", arguments.callee, false ); document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
jQuery.ready(); jQuery.ready();
}, false ); }, false );
@ -385,10 +385,10 @@ jQuery.extend({
} else if ( document.attachEvent ) { } else if ( document.attachEvent ) {
// ensure firing before onload, // ensure firing before onload,
// maybe late but safe also for iframes // maybe late but safe also for iframes
document.attachEvent("onreadystatechange", function() { document.attachEvent("onreadystatechange", function onreadystatechange() {
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
if ( document.readyState === "complete" ) { if ( document.readyState === "complete" ) {
document.detachEvent( "onreadystatechange", arguments.callee ); document.detachEvent( "onreadystatechange", onreadystatechange );
jQuery.ready(); jQuery.ready();
} }
}); });
@ -405,7 +405,9 @@ jQuery.extend({
} catch(e){} } catch(e){}
if ( document.documentElement.doScroll && toplevel ) { if ( document.documentElement.doScroll && toplevel ) {
(function() { doScrollCheck();
function doScrollCheck() {
if ( jQuery.isReady ) { if ( jQuery.isReady ) {
return; return;
} }
@ -415,13 +417,13 @@ jQuery.extend({
// http://javascript.nwbox.com/IEContentLoaded/ // http://javascript.nwbox.com/IEContentLoaded/
document.documentElement.doScroll("left"); document.documentElement.doScroll("left");
} catch( error ) { } catch( error ) {
setTimeout( arguments.callee, 0 ); setTimeout( doScrollCheck, 1 );
return; return;
} }
// and execute any waiting functions // and execute any waiting functions
jQuery.ready(); jQuery.ready();
})(); }
} }
} }
}, },

View file

@ -37,11 +37,11 @@ jQuery.event = {
// Init the element's event structure // Init the element's event structure
var events = jQuery.data( elem, "events" ) || jQuery.data( elem, "events", {} ), var events = jQuery.data( elem, "events" ) || jQuery.data( elem, "events", {} ),
handle = jQuery.data( elem, "handle" ) || jQuery.data( elem, "handle", function() { handle = jQuery.data( elem, "handle" ) || jQuery.data( elem, "handle", function eventHandle() {
// Handle the second event of a trigger and when // Handle the second event of a trigger and when
// an event is called after a page has unloaded // an event is called after a page has unloaded
return typeof jQuery !== "undefined" && !jQuery.event.triggered ? return typeof jQuery !== "undefined" && !jQuery.event.triggered ?
jQuery.event.handle.apply( arguments.callee.elem, arguments ) : jQuery.event.handle.apply( eventHandle.elem, arguments ) :
undefined; undefined;
}); });
// Add elem as a property of the handle function // Add elem as a property of the handle function