Skip to content

Commit 2f0261b

Browse files
committed
2 parents e37d4ac + ce45bae commit 2f0261b

File tree

27 files changed

+42
-42
lines changed

27 files changed

+42
-42
lines changed

1-js/02-first-steps/04-variables/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ And the last note. There are some lazy programmers who, instead of declaring a n
314314
315315
As the result, the variable is like a box where people throw different things without changing the sticker. What is inside it now? Who knows... We need to come closer and check.
316316
317-
Such a programmer saves a little bit on variable declaration, but looses ten times more on debugging the code.
317+
Such a programmer saves a little bit on variable declaration, but loses ten times more on debugging the code.
318318
319319
An extra variable is good, not evil.
320320

1-js/02-first-steps/05-types/article.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# Data types
22

3-
A variable in JavaScript can contain any data. A variable can at one moment be a string and later recieve a numeric value:
3+
A variable in JavaScript can contain any data. A variable can at one moment be a string and later receive a numeric value:
44

55
```js
66
// no error
77
let message = "hello";
88
message = 123456;
99
```
1010

11-
Programming languages that allow such thing are called "dynamically typed", meaning that there are data types, but variables are not bound to any of them.
11+
Programming languages that allow such things are called "dynamically typed", meaning that there are data types, but variables are not bound to any of them.
1212

1313
There are 7 basic data types in JavaScript. Here we'll study the basics, and in next chapters we'll talk about each of them in detail.
1414

1-js/02-first-steps/12-while-for/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ do {
8282
} while (i < 3);
8383
```
8484

85-
This form of syntax is rarely used. Usually, if there's no special reason, the other form is preferred: `while(…) {…}`.
85+
This form of syntax is rarely used except when you want the body of the loop to execute **at least once** regardless of the condition being truthy. Usually, the other form is preferred: `while(…) {…}`.
8686

8787
## The "for" loop
8888

1-js/07-object-oriented-programming/09-class/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ class User {
114114
115115
constructor(name) {
116116
// invokes the setter
117-
this.name = name;
117+
this._name = name;
118118
}
119119
120120
*!*

2-ui/1-document/04-searching-elements-dom/article.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ We can use it to access the element, like this:
2222
2323
// for elem-content things are a bit more complex
2424
// that has a dash inside, so it can't be a variable name
25-
alert(window['elem-content']); // ...but accessable using square brackets [...]
25+
alert(window['elem-content']); // ...but accessible using square brackets [...]
2626
</script>
2727
```
2828

@@ -194,7 +194,7 @@ Here we look for all `<li>` elements that are last children:
194194
This method is indeed powerful, because any CSS selector can be used.
195195
196196
```smart header="Can use pseudo-classes as well"
197-
Pseudo-classes in the CSS selector like `:hover` and `:active` are also supported. For instance, `document.querySelectorAll(':hover')` will return the collection with elements that the pointer is over now (in nesting order: from the outmost `<html>` to the most nested one).
197+
Pseudo-classes in the CSS selector like `:hover` and `:active` are also supported. For instance, `document.querySelectorAll(':hover')` will return the collection with elements that the pointer is over now (in nesting order: from the outermost `<html>` to the most nested one).
198198
```
199199
200200

2-ui/1-document/06-dom-attributes-and-properties/article.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ So, if an attribute is non-standard, there won't be DOM-property for it. Is ther
8989

9090
Sure. All attributes are accessible using following methods:
9191

92-
- `elem.hasAttribute(name)` -- checks for existance.
92+
- `elem.hasAttribute(name)` -- checks for existence.
9393
- `elem.getAttribute(name)` -- gets the value.
9494
- `elem.setAttribute(name, value)` -- sets the value.
9595
- `elem.removeAttribute(name)` -- removes the attribute.
@@ -376,7 +376,7 @@ A small comparison:
376376

377377
Methods to work with attributes are:
378378

379-
- `elem.hasAttribute(name)` -- to check for existance.
379+
- `elem.hasAttribute(name)` -- to check for existence.
380380
- `elem.getAttribute(name)` -- to get the value.
381381
- `elem.setAttribute(name, value)` -- to set the value.
382382
- `elem.removeAttribute(name)` -- to remove the attribute.

2-ui/1-document/09-size-and-scroll/article.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ They include the content width together with paddings, but without the scrollbar
156156

157157
On the picture above let's first consider `clientHeight`: it's easier to evaluate. There's no horizontal scrollbar, so it's exactly the sum of what's inside the borders: CSS-height `200px` plus top and bottom paddings (`2*20px`) total `240px`.
158158

159-
Now `clientWidth` -- here the content width is not `300px`, but `284px`, because `16px` are occupied by the scrollbbar. So the sum is `284px` plus left and right paddings, total `324px`.
159+
Now `clientWidth` -- here the content width is not `300px`, but `284px`, because `16px` are occupied by the scrollbar. So the sum is `284px` plus left and right paddings, total `324px`.
160160

161161
**If there are no paddings, then `clientWidth/Height` is exactly the content area, inside the borders and the scrollbar (if any).**
162162

@@ -248,7 +248,7 @@ Why we should use geometry properties instead? There are two reasons:
248248
249249
And there's one more reason: a scrollbar. Sometimes the code that works fine without a scrollbar starts to bug with it, because a scrollbar takes the space from the content in some browsers. So the real width available for the content is *less* than CSS width. And `clientWidth/clientHeight` take that into account.
250250
251-
...But with `getComputedStyle(elem).width` the situation is different. Some browsers (e.g. Chrome) return the real inner width, minus the scrollbar, and some of them (e.g. Firefox) -- CSS width (ignore the scrollbar). Such cross-browser differences is the reason not to use `getComputedStyle`, but rather rely on geometry propeties.
251+
...But with `getComputedStyle(elem).width` the situation is different. Some browsers (e.g. Chrome) return the real inner width, minus the scrollbar, and some of them (e.g. Firefox) -- CSS width (ignore the scrollbar). Such cross-browser differences is the reason not to use `getComputedStyle`, but rather rely on geometry properties.
252252
253253
```online
254254
If your browser reserves the space for a scrollbar (most browsers for Windows do), then you can test it below.

2-ui/1-document/10-size-and-scroll-window/article.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
How to find out the width of the browser window? How to get the full height of the document, including the scrolled out part? How to scroll the page using JavaScript?
44

5-
From the DOM point of view, the root document element is `document.documentElement`. That element corresponds to `<html>` and has geometry properties described in the [previous chapter](info:size-and-scroll). For some cases we can use it, but there are additional methods and pecularities important enough to consider.
5+
From the DOM point of view, the root document element is `document.documentElement`. That element corresponds to `<html>` and has geometry properties described in the [previous chapter](info:size-and-scroll). For some cases we can use it, but there are additional methods and peculiarities important enough to consider.
66

77
[cut]
88

@@ -66,7 +66,7 @@ Regular elements have their current scroll state in `elem.scrollLeft/scrollTop`.
6666
6767
What's with the page? Most browsers provide `documentElement.scrollLeft/Top` for the document scroll, but Chrome/Safari/Opera have bugs (like [157855](https://code.google.com/p/chromium/issues/detail?id=157855), [106133](https://bugs.webkit.org/show_bug.cgi?id=106133)) and we should use `document.body` instead of `document.documentElement` there.
6868
69-
Luckily, we don't have to remember these pecularities at all, because of the special properties `window.pageXOffset/pageYOffset`:
69+
Luckily, we don't have to remember these peculiarities at all, because of the special properties `window.pageXOffset/pageYOffset`:
7070
7171
```js run
7272
alert('Current scroll from the top: ' + window.pageYOffset);

2-ui/1-document/11-coordinates/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Also:
5050

5151
- Coordinates may be decimal fractions. That's normal, internally browser uses them for calculations. We don't have to round them when setting to `style.position.left/top`, the browser is fine with fractions.
5252
- Coordinates may be negative. For instance, if the page is scrolled down and the `elem` top is now above the window then `elem.getBoundingClientRect().top` is negative.
53-
- Some browsers (like Chrome) also add to the result `getBoundingClientRect` properties `width` and `height`. We can get them also by substraction: `height=bottom-top`, `width=right-left`.
53+
- Some browsers (like Chrome) also add to the result `getBoundingClientRect` properties `width` and `height`. We can get them also by subtraction: `height=bottom-top`, `width=right-left`.
5454

5555
```warn header="Coordinates right/bottom are different from CSS properties"
5656
If we compare window coordinates versus CSS positioning, then there are obvious similarities to `position:fixed` -- also the position relative to the viewport.

2-ui/2-events/04-default-browser-action/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ If we omit `return false`, then after our code executes the browser will do its
7878
By the way, using event delegation here makes our menu flexible. We can add nested lists and style them using CSS to "slide down".
7979

8080

81-
## Prevent futher events
81+
## Prevent further events
8282

8383
Certain events flow one into another. If we prevent the first event, there will be no second.
8484

0 commit comments

Comments
 (0)