Fix grammar

This commit is contained in:
jonathanlu31 2021-06-02 11:11:48 -07:00 committed by GitHub
parent cf33b67042
commit ffcb5da587
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,7 +17,7 @@ There are two ways to tell the browser we don't want it to act:
- The main way is to use the `event` object. There's a method `event.preventDefault()`. - The main way is to use the `event` object. There's a method `event.preventDefault()`.
- If the handler is assigned using `on<event>` (not by `addEventListener`), then returning `false` also works the same. - If the handler is assigned using `on<event>` (not by `addEventListener`), then returning `false` also works the same.
In this HTML a click on a link doesn't lead to navigation, browser doesn't do anything: In this HTML, a click on a link doesn't lead to navigation; the browser doesn't do anything:
```html autorun height=60 no-beautify ```html autorun height=60 no-beautify
<a href="/" onclick="return false">Click here</a> <a href="/" onclick="return false">Click here</a>
@ -96,7 +96,7 @@ That's because the browser action is canceled on `mousedown`. The focusing is st
The optional `passive: true` option of `addEventListener` signals the browser that the handler is not going to call `preventDefault()`. The optional `passive: true` option of `addEventListener` signals the browser that the handler is not going to call `preventDefault()`.
Why that may be needed? Why might that be needed?
There are some events like `touchmove` on mobile devices (when the user moves their finger across the screen), that cause scrolling by default, but that scrolling can be prevented using `preventDefault()` in the handler. There are some events like `touchmove` on mobile devices (when the user moves their finger across the screen), that cause scrolling by default, but that scrolling can be prevented using `preventDefault()` in the handler.