Inline jQuery(function(){})
and jQuery.ready
queue to enable async loading of jQuery. It also queues jQuery.noConflict
.
Include jquery-stub.js
before inline code that uses jQuery
.
When using $async you can use jquery-stub-async.js
to simply hook into the jQuery dependency or other dependencies.
You could use fn.toString()
and a regular expression to selectively set the dependencies.
$async.js({
src: '', // to save size, $async does not verify src and fails when omitted.
inline: callback_name + '();',
dependencies: 'jquery',
exec_timing: 'requestIdleCallback'
});