You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 2-ui/1-document/08-styles-and-classes/article.md
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,7 @@ For other cases, like making the text red, adding a background icon -- describe
26
26
27
27
## className and classList
28
28
29
-
Changing a class is one of the most often actions in scripts.
29
+
Changing a class is one of the most often used actions in scripts.
30
30
31
31
In the ancient time, there was a limitation in JavaScript: a reserved word like `"class"` could not be an object property. That limitation does not exist now, but at that time it was impossible to have a `"class"` property, like `elem.class`.
32
32
@@ -76,7 +76,7 @@ Besides that, `classList` is iterable, so we can list all classes like this:
76
76
```html run
77
77
<bodyclass="main page">
78
78
<script>
79
-
for(let name ofdocument.body.classList) {
79
+
for(let name ofdocument.body.classList) {
80
80
alert(name); // main, and then page
81
81
}
82
82
</script>
@@ -223,7 +223,7 @@ element
223
223
: Element to read the value for.
224
224
225
225
pseudo
226
-
: A pseudo-element if required, for instance `::before`. An empty string or no argument mean the element itself.
226
+
: A pseudo-element if required, for instance `::before`. An empty string or no argument means the element itself.
227
227
228
228
The result is an object with style properties, like `elem.style`, but now with respect to all CSS classes.
229
229
@@ -250,10 +250,10 @@ For instance:
250
250
```smart header="Computed and resolved values"
251
251
There are two concepts in [CSS](https://drafts.csswg.org/cssom/#resolved-values):
252
252
253
-
1. A *computed* style value is the value after all CSS rules and CSS inheritance is applied, as the result of the CSS cascade. If can look like `height:1em` or `font-size:125%`.
253
+
1. A *computed* style value is the value after all CSS rules and CSS inheritance is applied, as the result of the CSS cascade. It can look like `height:1em` or `font-size:125%`.
254
254
2. A *resolved* style value is the one finally applied to the element. Values like `1em` or `125%` are relative. The browser takes the computed value and makes all units fixed and absolute, for instance: `height:20px` or `font-size:16px`. For geometry properties resolved values may have a floating point, like `width:50.5px`.
255
255
256
-
Long time ago `getComputedStyle` was created to get computed values, but it turned out that resolved values are much more convenient, and the standard changed.
256
+
A long time ago `getComputedStyle` was created to get computed values, but it turned out that resolved values are much more convenient, and the standard changed.
257
257
258
258
So nowadays `getComputedStyle` actually returns the resolved value of the property.
259
259
```
@@ -283,7 +283,7 @@ Visited links may be colored using `:visited` CSS pseudoclass.
283
283
284
284
But `getComputedStyle` does not give access to that color, because otherwise an arbitrary page could find out whether the user visited a link by creating it on the page and checking the styles.
285
285
286
-
JavaScript we may not see the styles applied by `:visited`. And also, there's a limitation in CSS that forbids to apply geometry-changing styles in `:visited`. That's to guarantee that there's no side way for an evil page to test if a link was visited and hence to break the privacy.
286
+
JavaScript we may not see the styles applied by `:visited`. And also, there's a limitation in CSS that forbids to apply geometry-changing styles in `:visited`. That's to guarantee that there's no sideway for an evil page to test if a link was visited and hence to break the privacy.
0 commit comments