views:

27

answers:

1

Is it possible to report all the observers of the 'ready' events. I have a page where something is happening twice, and i'm trying to chase it back to the source.

A: 

Unfortunately you can't do this after it's executed, as it's a special event handler, which that "duplicate" question doesn't really cover.

$(document).ready(func) (or $(func)) or stores the functions you want to call in readyList (internal array). Unfortunately for your situation, but good for performance/garbage collection, this list is nulled out after it runs, so you can't get the list you're looking for.

You can see how this happens in jQuery core here.

Your best bet would be console.log() in a few functions /files to see if you get any duplicates I'd say.

Nick Craver
in theory I could add code to my copy of core and log the contents of readylist....
Adrian
@Adrian - That's another option, I'd suggest adding it before line 242 here: http://github.com/jquery/jquery/blob/master/src/core.js#L247
Nick Craver