Skip to content

Commit f599bf0

Browse files
committed
# Conflicts: # 1-js/05-data-types/02-number/article.md
2 parents b78afda + 03499d6 commit f599bf0

10 files changed

Lines changed: 16 additions & 16 deletions

File tree

1-js/09-classes/03-static-properties-methods/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ User.staticMethod(); // true
2020
That actually does the same as assigning it as a property directly:
2121

2222
```js run
23-
class User() { }
23+
class User { }
2424

2525
User.staticMethod = function() {
2626
alert(this === User);

1-js/12-generators-iterators/1-generators/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ generator.next(4); // --> pass the result into the generator
343343

344344
![](genYield2.svg)
345345

346-
1. The first call `generator.next()` is always without an argument. It starts the execution and returns the result of the first `yield "2+2=?"`. At this point the generator pauses the execution (still on that line).
346+
1. The first call `generator.next()` should be always made without an argument (the argument is ignored if passed). It starts the execution and returns the result of the first `yield "2+2=?"`. At this point the generator pauses the execution, while staying on the line `(*)`.
347347
2. Then, as shown at the picture above, the result of `yield` gets into the `question` variable in the calling code.
348348
3. On `generator.next(4)`, the generator resumes, and `4` gets in as the result: `let result = 4`.
349349

2-ui/1-document/07-modifying-document/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ So if we need to add a lot of text into HTML dynamically, and we're at page load
540540
- `"beforeend"` -- insert `html` into `elem`, at the end,
541541
- `"afterend"` -- insert `html` right after `elem`.
542542

543-
Also there are also similar methods, `elem.insertAdjacentText` and `elem.insertAdjacentElement`, that insert text strings and elements, but they are rarely used.
543+
Also there are similar methods, `elem.insertAdjacentText` and `elem.insertAdjacentElement`, that insert text strings and elements, but they are rarely used.
544544

545545
- To append HTML to the page before it has finished loading:
546546
- `document.write(html)`

2-ui/2-events/01-introduction-browser-events/07-carousel/solution.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The images ribbon can be represented as `ul/li` list of images `<img>`.
22

3-
Normally, such a ribbon is wide, but we put a fixed-size `<div>` around to "cut" it, so that only a part of the ribbon is visibble:
3+
Normally, such a ribbon is wide, but we put a fixed-size `<div>` around to "cut" it, so that only a part of the ribbon is visible:
44

55
![](carousel1.svg)
66

2-ui/2-events/02-bubbling-and-capturing/article.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ For instance, if we have a single handler `form.onclick`, then it can "catch" al
6868

6969
In `form.onclick` handler:
7070

71-
- `this` (`=event.currentTarget`) is the `<form>` element, because the handler runs on it.
71+
- `this` (=`event.currentTarget`) is the `<form>` element, because the handler runs on it.
7272
- `event.target` is the actual element inside the form that was clicked.
7373

7474
Check it out:
@@ -102,7 +102,7 @@ To stop the bubbling and prevent handlers on the current element from running, t
102102
```
103103

104104
```warn header="Don't stop bubbling without a need!"
105-
Bubbling is convenient. Don't stop it without a real need: obvious and architecturally well-thought.
105+
Bubbling is convenient. Don't stop it without a real need: obvious and architecturally well thought out.
106106
107107
Sometimes `event.stopPropagation()` creates hidden pitfalls that later may become problems.
108108

2-ui/2-events/03-event-delegation/article.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ The handler reads the attribute and executes the method. Take a look at the work
163163

164164
Please note that `this.onClick` is bound to `this` in `(*)`. That's important, because otherwise `this` inside it would reference the DOM element (`elem`), not the `Menu` object, and `this[action]` would not be what we need.
165165

166-
So, what the delegation gives us here?
166+
So, what advantages does delegation give us here?
167167

168168
```compare
169169
+ We don't need to write the code to assign a handler to each button. Just make a method and put it in the markup.
@@ -242,13 +242,13 @@ That may become really convenient -- no need to write JavaScript for every such
242242

243243
We can combine multiple behaviors on a single element as well.
244244

245-
The "behavior" pattern can be an alternative of mini-fragments of JavaScript.
245+
The "behavior" pattern can be an alternative to mini-fragments of JavaScript.
246246

247247
## Summary
248248

249249
Event delegation is really cool! It's one of the most helpful patterns for DOM events.
250250

251-
It's often used to add same handling for many similar elements, but not only for that.
251+
It's often used to add the same handling for many similar elements, but not only for that.
252252

253253
The algorithm:
254254

@@ -261,12 +261,12 @@ Benefits:
261261
```compare
262262
+ Simplifies initialization and saves memory: no need to add many handlers.
263263
+ Less code: when adding or removing elements, no need to add/remove handlers.
264-
+ DOM modifications: we can mass add/remove elements with `innerHTML` and alike.
264+
+ DOM modifications: we can mass add/remove elements with `innerHTML` and the like.
265265
```
266266

267267
The delegation has its limitations of course:
268268

269269
```compare
270270
- First, the event must be bubbling. Some events do not bubble. Also, low-level handlers should not use `event.stopPropagation()`.
271-
- Second, the delegation may add CPU load, because the container-level handler reacts on events in any place of the container, no matter if they interest us or not. But usually the load is negligible, so we don't take it into account.
271+
- Second, the delegation may add CPU load, because the container-level handler reacts on events in any place of the container, no matter whether they interest us or not. But usually the load is negligible, so we don't take it into account.
272272
```

2-ui/3-event-details/1-mouse-events-basics/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ So if we want to support combinations like `key:Ctrl`+click, then for Mac it mak
110110

111111
Even if we'd like to force Mac users to `key:Ctrl`+click -- that's kind of difficult. The problem is: a left-click with `key:Ctrl` is interpreted as a *right-click* on MacOS, and it generates the `contextmenu` event, not `click` like Windows/Linux.
112112

113-
So if we want users of all operational systems to feel comfortable, then together with `ctrlKey` we should check `metaKey`.
113+
So if we want users of all operating systems to feel comfortable, then together with `ctrlKey` we should check `metaKey`.
114114

115115
For JS-code it means that we should check `if (event.ctrlKey || event.metaKey)`.
116116
```

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ When the pointer leaves an element -- `mouseleave` triggers.
145145
```online
146146
This example is similar to the one above, but now the top element has `mouseenter/mouseleave` instead of `mouseover/mouseout`.
147147
148-
As you can see, the only generated events are the ones related to moving the pointer in and out of the top element. Nothing happens when the pointer goes to the child and back. Transitions between descendants are ignores
148+
As you can see, the only generated events are the ones related to moving the pointer in and out of the top element. Nothing happens when the pointer goes to the child and back. Transitions between descendants are ignored
149149
150150
[codetabs height=340 src="mouseleave"]
151151
```

2-ui/99-ui-misc/02-selection-range/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ Form elements, such as `input` and `textarea` provide [special API for selection
428428

429429
Properties:
430430
- `input.selectionStart` -- position of selection start (writeable),
431-
- `input.selectionEnd` -- position of selection start (writeable),
431+
- `input.selectionEnd` -- position of selection end (writeable),
432432
- `input.selectionDirection` -- selection direction, one of: "forward", "backward" or "none" (if e.g. selected with a double mouse click),
433433

434434
Events:

5-network/02-formdata/article.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ In this example, the server code is not presented, as it's beyound our scope. Th
5454
We can modify fields in `FormData` with methods:
5555

5656
- `formData.append(name, value)` - add a form field with the given `name` and `value`,
57-
- `formData.append(name, blob, fileName)` - add a field as if it were `<input type="file">`, the third argument `fileName` sets file name (not form field name), as it it were a name of the file in user's filesystem,
57+
- `formData.append(name, blob, fileName)` - add a field as if it were `<input type="file">`, the third argument `fileName` sets file name (not form field name), as it were a name of the file in user's filesystem,
5858
- `formData.delete(name)` - remove the field with the given `name`,
5959
- `formData.get(name)` - get the value of the field with the given `name`,
6060
- `formData.has(name)` - if there exists a field with the given `name`, returns `true`, otherwise `false`
6161

6262
A form is technically allowed to have many fields with the same `name`, so multiple calls to `append` add more same-named fields.
6363

64-
There's also method `set`, with the same syntax as `append`. The difference is that `.set` removes all fields with the given `name`, and then appends a new field. So it makes sure there's only field with such `name`, the rest is just like `append`:
64+
There's also method `set`, with the same syntax as `append`. The difference is that `.set` removes all fields with the given `name`, and then appends a new field. So it makes sure there's only one field with such `name`, the rest is just like `append`:
6565

6666
- `formData.set(name, value)`,
6767
- `formData.set(name, blob, fileName)`.

0 commit comments

Comments
 (0)