I have replaced window.addEventListener('DOMContentLoaded', function() {});
with jQuery's $(document).bind('ready', function() {});
, because first one failed to work on IE < 9 and I did not wanted to play with .attachEvent()
for that dummy browser, if I could have this nicely covered by jQuery itself.
Shortly after replacement, I noticed that DOMContentLoaded
event was always fired around 0-2 miliseconds after page load / refresh (at least this is what was logged by my logging script), while .ready()
always requires at least 15-20 miliseconds, after page refresh, to be fired (again - as logged by script).
I'm asking purely for feeding my curiosity, why there is such "significant" delay? Of course, there is no problem for me, that jQuery is firing that event later. It is just, that because I want to know ALL the answers (and rule the world! :]), I can't sleep with that! :]
EDIT: in .ready() function doc some user (Nick (of Nexxar)) points out that: "jQuery simulates the non existing "DOMContentLoaded" event on IE, but the used mechanism fires much later than the event used on other browsers". Maybe this is the same, I'm asking for?