Skip to content

Commit c3fadb7

Browse files
committed
minor
1 parent db0407b commit c3fadb7

File tree

3 files changed

+4
-4
lines changed
  • 2-ui
    • 2-events/05-dispatch-events
    • 3-event-details/3-mousemove-mouseover-mouseout-mouseenter-mouseleave/2-hoverintent
    • 5-loading/03-onload-onerror

3 files changed

+4
-4
lines changed

2-ui/2-events/05-dispatch-events/article.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
We can not only assign handlers, but also generate events from JavaScript.
44

5-
Custom events can be used to create "graphical components". For instance, a root element of our own JS-based menu may trigger events telling what happens with the menu: `open` (menu open), `select` (an item is selected) and so on. Another code may listen to the events and observe what's happening with the menu.
5+
Custom events can be used to create "graphical components". For instance, a root element of our own JS-based menu may trigger events telling what happens with the menu: `open` (menu open), `select` (an item is selected) and so on. Another code may listen for the events and observe what's happening with the menu.
66

77
We can generate not only completely new events, that we invent for our own purposes, but also built-in ones, such as `click`, `mousedown` etc. That may be helpful for automated testing.
88

@@ -174,7 +174,7 @@ Let's see a practical example - a hiding rabbit (could be a closing menu or some
174174

175175
Below you can see a `#rabbit` and `hide()` function that dispatches `"hide"` event on it, to let all interested parties know that the rabbit is going to hide.
176176

177-
Any handler can listen to that event with `rabbit.addEventListener('hide',...)` and, if needed, cancel the action using `event.preventDefault()`. Then the rabbit won't disappear:
177+
Any handler can listen for that event with `rabbit.addEventListener('hide',...)` and, if needed, cancel the action using `event.preventDefault()`. Then the rabbit won't disappear:
178178

179179
```html run refresh autorun
180180
<pre id="rabbit">

2-ui/3-event-details/3-mousemove-mouseover-mouseout-mouseenter-mouseleave/2-hoverintent/solution.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ The first idea can be: run a function every `100ms` and measure the distance bet
1111

1212
Unfortunately, there's no way to get "current mouse coordinates" in JavaScript. There's no function like `getCurrentMouseCoordinates()`.
1313

14-
The only way to get coordinates is to listen to mouse events, like `mousemove`, and take coordinates from the event object.
14+
The only way to get coordinates is to listen for mouse events, like `mousemove`, and take coordinates from the event object.
1515

1616
So let's set a handler on `mousemove` to track coordinates and remember them. And then compare them, once per `100ms`.
1717

2-ui/5-loading/03-onload-onerror/article.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ Details may vary depending on the browser, but the idea is same: any information
159159

160160
Why do we need error details?
161161

162-
There are many services (and we can build our own) that listen to global errors using `window.onerror`, save errors and provide an interface to access and analyze them. That's great, as we can see real errors, triggered by our users. But if a script comes from another origin, then there's no much information about errors in it, as we've just seen.
162+
There are many services (and we can build our own) that listen for global errors using `window.onerror`, save errors and provide an interface to access and analyze them. That's great, as we can see real errors, triggered by our users. But if a script comes from another origin, then there's no much information about errors in it, as we've just seen.
163163

164164
Similar cross-origin policy (CORS) is enforced for other types of resources as well.
165165

0 commit comments

Comments
 (0)