I'm wanting to hook IIFE functions:
(function(p) {
// stuff
})();
I ask this in general sense, though the specific reason is that WordPress plugins often drop inline scripts right into the body output. If you want to defer (async) load dependencies for SEO reasons, it naturally fails.
In an effort to fix endless poor coding practices by plugin providers, and plugins that simply aren't designed with asynchronous loading in mind, I want to do such a thing.
I'm trying to avoid:
- Modifying vendor code directly.
- Parsing raw content using PHP.
- Blocking existing server-side systems of loading JavaScript resources, in order to appropriately load them later.
I'm wondering if there is some extremely low level prototype in the browser dom that can be used to intercept functions of that nature?