From f8570ae3a04cc0951efa45a7ed083ba3b89b2c2e Mon Sep 17 00:00:00 2001 From: Ilya Kantor Date: Sat, 11 May 2019 11:28:46 +0300 Subject: [PATCH] fixes --- .../09-call-apply-decorators/article.md | 2 +- 2-ui/3-event-details/5-keyboard-events/article.md | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/1-js/06-advanced-functions/09-call-apply-decorators/article.md b/1-js/06-advanced-functions/09-call-apply-decorators/article.md index 75c510d1..33a4bb8f 100644 --- a/1-js/06-advanced-functions/09-call-apply-decorators/article.md +++ b/1-js/06-advanced-functions/09-call-apply-decorators/article.md @@ -453,7 +453,7 @@ let wrapper = function() { } ``` -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. +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. There are many decorators there in the wild. Check how well you got them by solving the tasks of this chapter. diff --git a/2-ui/3-event-details/5-keyboard-events/article.md b/2-ui/3-event-details/5-keyboard-events/article.md index 92fc2b9b..aad83911 100644 --- a/2-ui/3-event-details/5-keyboard-events/article.md +++ b/2-ui/3-event-details/5-keyboard-events/article.md @@ -97,14 +97,14 @@ For example, here are US layout ("QWERTY") and German layout ("QWERTZ") under it ![](german-layout.png) -For the same key, US layout has "Z", while German layout has "Y" and (letters are swapped). +For the same key, US layout has "Z", while German layout has "Y" (letters are swapped). -So, `event.code` will equal `KeyZ` for German people who press "Y". Just because the keyboard layout is different. +So, `event.code` will equal `KeyZ` for people with German layout when they press "Y". 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. -- `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. -- `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). +- `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. +- `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). So, to reliably track layout-dependent characters, `event.key` may be a better way.