I’m adding an event-handler by using
window.addEventListener('keydown',mainf);
and in a child-span element inserted later using innerHTML=
I have an inline eventhandler like
<span id="closeLink" onkeypress="this.onclick(event);" tabindex="1" onclick="closef(event);">Close</span>
If I use the tab key to put the focus on the span-element and hit the Enter
-key, the console-output in the functions mainf
and closef
show that closef
is called after mainf
, though closef
-event-phase shows 2
,but mainf
-event-phase shows 3
.
mainf event.target.id is closeLink
mainf current event.eventPhase: 3
closef event: keypress { target: span#closeLink, key: "Enter", charCode: 0, keyCode: 13 }
closef current event.eventPhase: 2
So, are inline attached events always checked after events added by addEventListener in html/javascript?
I’m using Firefox 91.3