document.ready() callbacks are called in the order in which they were registered. If you register a test callback first, it will be called first.
In addition, if your test code does not really need to manipulate the DOM, you can run it when the code is parsed, and do not wait until the DOM is ready, which will be executed before other document.ready() callbacks are called , Or, perhaps you can immediately run part of your test code and defer only the part using the DOM to document.ready() .
Another idea (for testing only) you can run with a slightly modified version of jQuery, which added the document.ready() flag, which, when passed and set to true indicated to call this function first, or you can add a new document.readyFirst() , which will call your function first. This will be due to minor changes to the document.ready() processing code in jQuery.
source share