lundi 4 juillet 2016

When one calls addEventListener without a target element what element does it default to?

addEventListener("load", run);

function run() {    //code }

The above code appears to work when I try it in a web browser. My guess would be that this is because if one uses addEventListener without a target element it defaults to the window object?

Can anyone confirm this?




Aucun commentaire:

Enregistrer un commentaire