Skip to content

Commit 0c6a4ac

Browse files
authored
Update article.md
Minor grammar changes, clarify that if using a class for `handleEvent` we still are actually using an object as we have to instantiate the class.
1 parent 53b35c1 commit 0c6a4ac

File tree

1 file changed

+5
-5
lines changed
  • 2-ui/2-events/01-introduction-browser-events

1 file changed

+5
-5
lines changed

2-ui/2-events/01-introduction-browser-events/article.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ input.removeEventListener("click", handler);
261261
Please note -- if we don't store the function in a variable, then we can't remove it. There's no way to "read back" handlers assigned by `addEventListener`.
262262
````
263263

264-
Multiple calls to `addEventListener` allow to add multiple handlers, like this:
264+
Multiple calls to `addEventListener` allow it to add multiple handlers, like this:
265265

266266
```html run no-beautify
267267
<input id="elem" type="button" value="Click me"/>
@@ -288,7 +288,7 @@ As we can see in the example above, we can set handlers *both* using a DOM-prope
288288
````warn header="For some events, handlers only work with `addEventListener`"
289289
There exist events that can't be assigned via a DOM-property. Only with `addEventListener`.
290290

291-
For instance, the `DOMContentLoaded` event, that triggers when the document is loaded and DOM is built.
291+
For instance, the `DOMContentLoaded` event, that triggers when the document is loaded and the DOM has been built.
292292

293293
```js
294294
// will never run
@@ -334,10 +334,10 @@ Some properties of `event` object:
334334
`event.currentTarget`
335335
: Element that handled the event. That's exactly the same as `this`, unless the handler is an arrow function, or its `this` is bound to something else, then we can get the element from `event.currentTarget`.
336336
337-
`event.clientX / event.clientY`
337+
`event.clientX` / `event.clientY`
338338
: Window-relative coordinates of the cursor, for pointer events.
339339
340-
There are more properties. Many of them depend on the event type: keyboard events have one set of properties, pointer events - another one, we'll study them later when we come to different events in details.
340+
There are more properties. Many of them depend on the event type: keyboard events have one set of properties, pointer events - another one, we'll study them later when as we move on to the details of different events.
341341
342342
````smart header="The event object is also available in HTML handlers"
343343
If we assign a handler in HTML, we can also use the `event` object, like this:
@@ -373,7 +373,7 @@ For instance:
373373

374374
As we can see, when `addEventListener` receives an object as the handler, it calls `obj.handleEvent(event)` in case of an event.
375375

376-
We could also use a class for that:
376+
We could also use a class (although we still have to instantiate it as an object):
377377

378378

379379
```html run

0 commit comments

Comments
 (0)