W
William Wallace
I can't find a definite answer anywhere on when's the right time to
use window. and when is the right time to use document. when it comes
to prefixing a call to addEventListener or attachEvent.
I've seen people using window.addEventlistener for onload, mouse
events and I've seen others using document.addEventListener for those
same things. I can see how some appear to be more obvious, like DOM
events such as node inserted events - they'd definitely have a strong
argument for being document.addEventListener.
So, are the two completely interchangeable on the top 5 browsers?
use window. and when is the right time to use document. when it comes
to prefixing a call to addEventListener or attachEvent.
I've seen people using window.addEventlistener for onload, mouse
events and I've seen others using document.addEventListener for those
same things. I can see how some appear to be more obvious, like DOM
events such as node inserted events - they'd definitely have a strong
argument for being document.addEventListener.
So, are the two completely interchangeable on the top 5 browsers?