Skip to content

Commit f8570ae

Browse files
committed
fixes
1 parent f8f3c94 commit f8570ae

File tree

2 files changed

+5
-5
lines changed
  • 1-js/06-advanced-functions/09-call-apply-decorators
  • 2-ui/3-event-details/5-keyboard-events

2 files changed

+5
-5
lines changed

1-js/06-advanced-functions/09-call-apply-decorators/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ let wrapper = function() {
453453
}
454454
```
455455

456-
We also saw an example of *method borrowing* when we take a method from an object and `call` it in the context of another object. It is quite common to take array methods and apply them to arguments. The alternative is to use rest parameters object that is a real array.
456+
We also saw an example of *method borrowing* when we take a method from an object and `call` it in the context of another object. It is quite common to take array methods and apply them to `arguments`. The alternative is to use rest parameters object that is a real array.
457457

458458

459459
There are many decorators there in the wild. Check how well you got them by solving the tasks of this chapter.

2-ui/3-event-details/5-keyboard-events/article.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,14 @@ For example, here are US layout ("QWERTY") and German layout ("QWERTZ") under it
9797

9898
![](german-layout.png)
9999

100-
For the same key, US layout has "Z", while German layout has "Y" and (letters are swapped).
100+
For the same key, US layout has "Z", while German layout has "Y" (letters are swapped).
101101

102-
So, `event.code` will equal `KeyZ` for German people who press "Y". Just because the keyboard layout is different.
102+
So, `event.code` will equal `KeyZ` for people with German layout when they press "Y".
103103

104104
That sounds odd, but so it is. The [specification](https://www.w3.org/TR/uievents-code/#table-key-code-alphanumeric-writing-system) explicitly mentions such behavior.
105105

106-
- `event.code` has the benefit of being the same, even if the visitor changes languages. So hotkeys that rely on it work well even in case of a language switch.
107-
- `event.code` may match a wrong character for unexpected layout. Same letters in different layouts may be at different keyboard keys, leading to different codes. That happens for several codes, e.g. `keyA`, `keyQ`, `keyZ`. You can find the list in the [specification](https://www.w3.org/TR/uievents-code/#table-key-code-alphanumeric-writing-system).
106+
- `event.code` has the benefit of staying always the same, bound to the physical key location, even if the visitor changes languages. So hotkeys that rely on it work well even in case of a language switch.
107+
- `event.code` may match a wrong character for unexpected layout. Same letters in different layouts may map to different physical keys, leading to different codes. That happens for several codes, e.g. `keyA`, `keyQ`, `keyZ` (as we've seen). You can find the list in the [specification](https://www.w3.org/TR/uievents-code/#table-key-code-alphanumeric-writing-system).
108108

109109
So, to reliably track layout-dependent characters, `event.key` may be a better way.
110110

0 commit comments

Comments
 (0)