I have been using events
in javascript for 4 years, but I am only now starting to learn about the event object in detail.
I understand that the event object has 10 properties:
bubbles
cancelable
currentTarget
defaultPrevented
eventPhase
isTrusted
target
timeStamp
type
view
and each of these properties can be accessed within an event-fired function using:
e.bubbles
e.cancelable
e.currentTarget
- etc.
But my question is, when an event listener fires a function:
function myFunction(e) {
[... CODE HERE...]
}
How does the browser know that the e
refers to the event object?
I understand that any name can represent the event object - e
, or event
or goldfish
or anything... but how does the browser know which of the function parameters is the event object?