fixes
This commit is contained in:
parent
5f9597d0c5
commit
11b1671764
4 changed files with 8 additions and 9 deletions
|
@ -49,8 +49,8 @@ class Article {
|
||||||
|
|
||||||
// usage
|
// usage
|
||||||
let articles = [
|
let articles = [
|
||||||
new Article("Mind", new Date(2019, 1, 1)),
|
new Article("HTML", new Date(2019, 1, 1)),
|
||||||
new Article("Body", new Date(2019, 0, 1)),
|
new Article("CSS", new Date(2019, 0, 1)),
|
||||||
new Article("JavaScript", new Date(2019, 11, 1))
|
new Article("JavaScript", new Date(2019, 11, 1))
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ let articles = [
|
||||||
articles.sort(Article.compare);
|
articles.sort(Article.compare);
|
||||||
*/!*
|
*/!*
|
||||||
|
|
||||||
alert( articles[0].title ); // Body
|
alert( articles[0].title ); // CSS
|
||||||
```
|
```
|
||||||
|
|
||||||
Here `Article.compare` stands "over" the articles, as a means to compare them. It's not a method of an article, but rather of the whole class.
|
Here `Article.compare` stands "over" the articles, as a means to compare them. It's not a method of an article, but rather of the whole class.
|
||||||
|
@ -171,7 +171,7 @@ rabbits[0].run(); // Black Rabbit runs with speed 5.
|
||||||
|
|
||||||
Now we can call `Rabbit.compare` assuming that the inherited `Animal.compare` will be called.
|
Now we can call `Rabbit.compare` assuming that the inherited `Animal.compare` will be called.
|
||||||
|
|
||||||
How does it work? Again, using prototypes. As you might have already guessed, extends also gives `Rabbit` the `[[Prototype]]` reference to `Animal`.
|
How does it work? Again, using prototypes. As you might have already guessed, `extends` gives `Rabbit` the `[[Prototype]]` reference to `Animal`.
|
||||||
|
|
||||||
|
|
||||||

|

|
||||||
|
@ -187,10 +187,10 @@ class Rabbit extends Animal {}
|
||||||
// for static properties and methods
|
// for static properties and methods
|
||||||
alert(Rabbit.__proto__ === Animal); // true
|
alert(Rabbit.__proto__ === Animal); // true
|
||||||
|
|
||||||
// and the next step is Function.prototype
|
// the next step up leads to Function.prototype
|
||||||
alert(Animal.__proto__ === Function.prototype); // true
|
alert(Animal.__proto__ === Function.prototype); // true
|
||||||
|
|
||||||
// that's in addition to the "normal" prototype chain for object methods
|
// the "normal" prototype chain for object methods
|
||||||
alert(Rabbit.prototype.__proto__ === Animal.prototype);
|
alert(Rabbit.prototype.__proto__ === Animal.prototype);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
# Export and Import
|
# Export and Import
|
||||||
|
|
||||||
Export and import directives are very versatile.
|
Export and import directives are very versatile.
|
||||||
|
|
|
@ -98,7 +98,7 @@ alert(elem.shadowRoot.host === elem); // true
|
||||||
|
|
||||||
Shadow DOM is strongly delimited from the main document:
|
Shadow DOM is strongly delimited from the main document:
|
||||||
|
|
||||||
1. Shadow DOM elements are not visible to `querySelector` from the light DOM. In particular, Shadow DOM elements may have ids that conflict with those in the light DOM. They be unique only within the shadow tree.
|
1. Shadow DOM elements are not visible to `querySelector` from the light DOM. In particular, Shadow DOM elements may have ids that conflict with those in the light DOM. They must be unique only within the shadow tree.
|
||||||
2. Shadow DOM has own stylesheets. Style rules from the outer DOM don't get applied.
|
2. Shadow DOM has own stylesheets. Style rules from the outer DOM don't get applied.
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
|
@ -263,7 +263,7 @@ Modern JavaScript allows to use these properties in regexps to look for characte
|
||||||
|
|
||||||
- A cyrillic letter is: `pattern:\p{Script=Cyrillic}` or `pattern:\p{sc=Cyrillic}`.
|
- A cyrillic letter is: `pattern:\p{Script=Cyrillic}` or `pattern:\p{sc=Cyrillic}`.
|
||||||
- A dash (be it a small hyphen `-` or a long dash `—`): `pattern:\p{Dash_Punctuation}` or `pattern:\p{pd}`.
|
- A dash (be it a small hyphen `-` or a long dash `—`): `pattern:\p{Dash_Punctuation}` or `pattern:\p{pd}`.
|
||||||
- A currency symbol: `pattern:\p{Currency_Symbol}` or `pattern:\p{sc}`.
|
- A currency symbol, such as `$`, `€` or another: `pattern:\p{Currency_Symbol}` or `pattern:\p{sc}`.
|
||||||
- ...And much more. Unicode has a lot of character categories that we can select from.
|
- ...And much more. Unicode has a lot of character categories that we can select from.
|
||||||
|
|
||||||
These patterns require `'u'` regexp flag to work. More about that in the chapter [](info:regexp-unicode).
|
These patterns require `'u'` regexp flag to work. More about that in the chapter [](info:regexp-unicode).
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue