When several $(document).ready functions are called, and one contains a JavaScript error, jQuery stops processing the rest of the queue

When several $(document).ready functions are called, and one contains a JavaScript error, jQuery stops processing the rest of the queue

I searched all around the forums and the Internet in general and could not find this topic.  It could be that the keywords just don't lend to good searchability.

We had a bug that was hard to find.  On some pages our  $(document).ready functions were firing and on some only a few were firing.  Our pages are on an enterprise site and several of the loaded scripts use the  $(document).ready function.  This creates a queue of functions that are fired.

It was found that on these "odd" pages we had forgotten to load a plug-in that was called in the  $(document).ready function. 

It turns out that when one of the queued $(document).ready functions contains an error jQuery stops processing the rest of the queue rather than continuing with the rest of the functions.

I'm not sure if this is by design or not but it would be helpful if just that function was terminated but the rest of the queue would still be processed.

I would love some feedback on this.

Thanks!
Matt Penner













    • Topic Participants

    • matt