The document discusses JavaScript events including event types, the event mechanism, and how to implement an event library. It covers topics like event registration, the event object, event bubbling, event targets, and how "this" works in events. It also outlines three versions of building an event library, with the third version combining the event object and custom data and encapsulating the original event.
81. Event Mechanism
“This” in Event
In Javascript this always refers to the “owner” of
the function we’re executing, or rather, to the
object that a function is a method of
82. Event Mechanism
“This” in Event
In Javascript this always refers to the “owner” of
the function we’re executing, or rather, to the
object that a function is a method of
Example: Register click handler on div1
83. Event Mechanism
“This” in Event
In Javascript this always refers to the “owner” of
the function we’re executing, or rather, to the
object that a function is a method of
Example: Register click handler on div1
84. Event Mechanism
“This” in Event
In Javascript this always refers to the “owner” of
the function we’re executing, or rather, to the
object that a function is a method of
Example: Register click handler on div1
85. Event Mechanism
“This” in Event
In Javascript this always refers to the “owner” of
the function we’re executing, or rather, to the
object that a function is a method of
Example: Register click handler on div1
86. Event Mechanism
“This” in Event
In Javascript this always refers to the “owner” of
the function we’re executing, or rather, to the
object that a function is a method of
Example: Register click handler on div1
87. Event Mechanism
“This” in Event
In Javascript this always refers to the “owner” of
the function we’re executing, or rather, to the
object that a function is a method of
Example: Register click handler on div1
88. Event Mechanism
“This” in Event
In Javascript this always refers to the “owner” of
the function we’re executing, or rather, to the
object that a function is a method of
Example: Register click handler on div1
89. Event Mechanism
“This” in Event
In Javascript this always refers to the “owner” of
the function we’re executing, or rather, to the
object that a function is a method of
Example: Register click handler on div1
90. Event Mechanism
“This” in Event
In Javascript this always refers to the “owner” of
the function we’re executing, or rather, to the
object that a function is a method of
Example: Register click handler on div1
91. Event Mechanism
“This” in Event
In Javascript this always refers to the “owner” of
the function we’re executing, or rather, to the
object that a function is a method of
Example: Register click handler on div1
92. Event Mechanism
“This” in Event
In Javascript this always refers to the “owner” of
the function we’re executing, or rather, to the
object that a function is a method of
Example: Register click handler on div1
93. Event Mechanism
“This” in Event
In Javascript this always refers to the “owner” of
the function we’re executing, or rather, to the
object that a function is a method of
Example: Register click handler on div1
94. Event Mechanism
“This” in Event
In Javascript this always refers to the “owner” of
the function we’re executing, or rather, to the
object that a function is a method of
Example: Register click handler on div1
95. Event Mechanism
“This” in Event
In Javascript this always refers to the “owner” of
the function we’re executing, or rather, to the
object that a function is a method of
Example: Register click handler on div1
96. Event Mechanism
“This” in Event
In Javascript this always refers to the “owner” of
the function we’re executing, or rather, to the
object that a function is a method of
Example: Register click handler on div1