Consider the following:
var a_script_from_my_dom = document.querySelector("script")
How can I test, preferably without the use of third party libraries, if this script has finished loading and executing? Assume that the script may have been inserted dynamically using createElement / appendChild
. Also assume that I have no power to change the loaded script to set specific variables or trigger specific behaviour.
I know that I can attach an onload handler, but if the script has already loaded, the handler won't run.