Skip to content

Commit c0d8fdb

Browse files
authored
Merge branch 'master' into patch-47
2 parents 25b414d + cd3774b commit c0d8fdb

File tree

6 files changed

+16
-16
lines changed

6 files changed

+16
-16
lines changed

1-js/08-prototypes/04-prototype-methods/article.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ Why so?
7272
That's for historical reasons.
7373

7474
- The `"prototype"` property of a constructor function has worked since very ancient times.
75-
- Later, in the year 2012: `Object.create` appeared in the standard. It gave the ability to create objects with a given prototype, but did not provide the ability to get/set it. So browsers implemented the non-standard `__proto__` accessor that allowed the user to get/set a prototype at any time.
76-
- Later, in the year 2015: `Object.setPrototypeOf` and `Object.getPrototypeOf` were added to the standard, to perform the same functionality as `__proto__`. As `__proto__` was de-facto implemented everywhere, it was kind-of deprecated and made its way to the Annex B of the standard, that is: optional for non-browser environments.
75+
- Later, in the year 2012, `Object.create` appeared in the standard. It gave the ability to create objects with a given prototype, but did not provide the ability to get/set it. So browsers implemented the non-standard `__proto__` accessor that allowed the user to get/set a prototype at any time.
76+
- Later, in the year 2015, `Object.setPrototypeOf` and `Object.getPrototypeOf` were added to the standard, to perform the same functionality as `__proto__`. As `__proto__` was de-facto implemented everywhere, it was kind-of deprecated and made its way to the Annex B of the standard, that is: optional for non-browser environments.
7777

7878
As of now we have all these ways at our disposal.
7979

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ class Rabbit extends Animal {}
192192
alert(Rabbit.__proto__ === Animal); // true
193193

194194
// for regular methods
195-
alert(Rabbit.prototype.__proto__ === Animal.prototype);
195+
alert(Rabbit.prototype.__proto__ === Animal.prototype); // true
196196
```
197197

198198
## Summary

1-js/09-classes/05-extend-natives/article.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ alert(filteredArr); // 10, 50
2121
alert(filteredArr.isEmpty()); // false
2222
```
2323

24-
Please note a very interesting thing. Built-in methods like `filter`, `map` and others -- return new objects of exactly the inherited type `PowerArray`. Their internal implementation uses object `constructor` property for that.
24+
Please note a very interesting thing. Built-in methods like `filter`, `map` and others -- return new objects of exactly the inherited type `PowerArray`. Their internal implementation uses the object's `constructor` property for that.
2525

2626
In the example above,
2727
```js
@@ -74,7 +74,7 @@ Built-in objects have their own static methods, for instance `Object.keys`, `Arr
7474

7575
As we already know, native classes extend each other. For instance, `Array` extends `Object`.
7676

77-
Normally, when one class extends another, both static and non-static methods are inherited. That was thoroughly explained in the chapter [](info:static-properties-methods#statics-and-inheritance).
77+
Normally, when one class extends another, both static and non-static methods are inherited. That was thoroughly explained in the article [](info:static-properties-methods#statics-and-inheritance).
7878

7979
But built-in classes are an exception. They don't inherit statics from each other.
8080

2-ui/1-document/01-browser-environment/article.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Browser environment, specs
22

3-
The JavaScript language was initially created for web browsers. Since then, it has evolved and become a language with many uses and platforms.
3+
The JavaScript language was initially created for web browsers. Since then it has evolved and become a language with many uses and platforms.
44

55
A platform may be a browser, or a web-server or another *host*, even a coffee machine. Each of them provides platform-specific functionality. The JavaScript specification calls that a *host environment*.
66

@@ -60,14 +60,14 @@ For instance, server-side scripts that download HTML pages and process them can
6060
```
6161

6262
```smart header="CSSOM for styling"
63-
CSS rules and stylesheets are structured in a different way than HTML. There's a separate specification [CSSOM](https://www.w3.org/TR/cssom-1/) that explains how they are represented as objects, and how to read and write them.
63+
CSS rules and stylesheets are structured in a different way than HTML. There's a separate specification, [CSS Object Model (CSSOM)](https://www.w3.org/TR/cssom-1/), that explains how they are represented as objects, and how to read and write them.
6464
6565
CSSOM is used together with DOM when we modify style rules for the document. In practice though, CSSOM is rarely required, because usually CSS rules are static. We rarely need to add/remove CSS rules from JavaScript, but that's also possible.
6666
```
6767

68-
## BOM (Browser object model)
68+
## BOM (Browser Object Model)
6969

70-
Browser Object Model (BOM) are additional objects provided by the browser (host environment) to work with everything except the document.
70+
The Browser Object Model (BOM) represents additional objects provided by the browser (host environment) for working with everything except the document.
7171

7272
For instance:
7373

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
@@ -132,9 +132,9 @@ To make the document unscrollable, it's enough to set `document.body.style.overf
132132
```online
133133
Try it:
134134
135-
<button onclick="document.body.style.overflow = 'hidden'">`document.body.style.overflow = 'hidden'`</button>
135+
<button onclick="document.body.style.overflow = 'hidden'">document.body.style.overflow = 'hidden'</button>
136136
137-
<button onclick="document.body.style.overflow = ''">`document.body.style.overflow = ''`</button>
137+
<button onclick="document.body.style.overflow = ''">document.body.style.overflow = ''</button>
138138
139139
The first button freezes the scroll, the second one resumes it.
140140
```

5-network/05-fetch-crossorigin/article.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ That policy is called "CORS": Cross-Origin Resource Sharing.
2222

2323
## Why CORS is needed? A brief history
2424

25-
CORS exists protect the internet from evil hackers.
25+
CORS exists to protect the internet from evil hackers.
2626

2727
Seriously. Let's make a very brief historical digression.
2828

@@ -149,7 +149,7 @@ As you can see, `Origin` header contains exactly the origin (domain/protocol/por
149149
The server can inspect the `Origin` and, if it agrees to accept such a request, adds a special header `Access-Control-Allow-Origin` to the response. That header should contain the allowed origin (in our case `https://javascript.info`), or a star `*`. Then the response is successful, otherwise an error.
150150

151151
The browser plays the role of a trusted mediator here:
152-
1. It ensures that the corrent `Origin` is sent with a cross-origin request.
152+
1. It ensures that the correct `Origin` is sent with a cross-origin request.
153153
2. It checks for permitting `Access-Control-Allow-Origin` in the response, if it exists, then JavaScript is allowed to access the response, otherwise it fails with an error.
154154

155155
![](xhr-another-domain.svg)
@@ -203,13 +203,13 @@ With such `Access-Control-Expose-Headers` header, the script is allowed to read
203203
204204
We can use any HTTP-method: not just `GET/POST`, but also `PATCH`, `DELETE` and others.
205205
206-
Some time ago no one could even assume that a webpage is able to do such requests. So there may exist webservices that treat a non-standard method as a signal: "That's not a browser". They can take it into account when checking access rights.
206+
Some time ago no one could even imagine that a webpage could make such requests. So there may still exist webservices that treat a non-standard method as a signal: "That's not a browser". They can take it into account when checking access rights.
207207
208208
So, to avoid misunderstandings, any "non-simple" request -- that couldn't be done in the old times, the browser does not make such requests right away. Before it sends a preliminary, so-called "preflight" request, asking for permission.
209209
210210
A preflight request uses method `OPTIONS`, no body and two headers:
211211
212-
- `Access-Control-Request-Method` header has the method of an the non-simple request.
212+
- `Access-Control-Request-Method` header has the method of the non-simple request.
213213
- `Access-Control-Request-Headers` header provides a comma-separated list of its non-simple HTTP-headers.
214214
215215
If the server agrees to serve the requests, then it should respond with empty body, status 200 and headers:
@@ -273,7 +273,7 @@ Access-Control-Allow-Headers: API-Key,Content-Type,If-Modified-Since,Cache-Contr
273273
Access-Control-Max-Age: 86400
274274
```
275275
276-
Now the browser can see that `PATCH` in `Access-Control-Allow-Methods` and `Content-Type,API-Key` are in the list `Access-Control-Allow-Headers`, so it sends out the main request.
276+
Now the browser can see that `PATCH` is in `Access-Control-Allow-Methods` and `Content-Type,API-Key` are in the list `Access-Control-Allow-Headers`, so it sends out the main request.
277277
278278
Besides, the preflight response is cached for time, specified by `Access-Control-Max-Age` header (86400 seconds, one day), so subsequent requests will not cause a preflight. Assuming that they fit the cached allowances, they will be sent directly.
279279

0 commit comments

Comments
 (0)