Skip to content

Commit cd27aff

Browse files
authored
Merge pull request #1631 from dashaezhova/patch-1
Update 'Window sizes and scrolling' article.md
2 parents d334cf8 + b5b91fa commit cd27aff

File tree

1 file changed

+2
-2
lines changed
  • 2-ui/1-document/10-size-and-scroll-window

1 file changed

+2
-2
lines changed

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ In modern HTML we should always write `DOCTYPE`.
4040
4141
## Width/height of the document
4242
43-
Theoretically, as the root document element is `documentElement.clientWidth/Height`, and it encloses all the content, we could measure document full size as `documentElement.scrollWidth/scrollHeight`.
43+
Theoretically, as the root document element is `document.documentElement`, and it encloses all the content, we could measure document full size as `document.documentElement.scrollWidth/scrollHeight`.
4444
4545
But on that element, for the whole page, these properties do not work as intended. In Chrome/Safari/Opera if there's no scroll, then `documentElement.scrollHeight` may be even less than `documentElement.clientHeight`! Sounds like a nonsense, weird, right?
4646
@@ -62,7 +62,7 @@ Why so? Better don't ask. These inconsistencies come from ancient times, not a "
6262
6363
DOM elements have their current scroll state in `elem.scrollLeft/scrollTop`.
6464
65-
For document scroll `document.documentElement.scrollLeft/Top` works in most browsers, except oldler WebKit-based ones, like Safari (bug [5991](https://bugs.webkit.org/show_bug.cgi?id=5991)), where we should use `document.body` instead of `document.documentElement`.
65+
For document scroll `document.documentElement.scrollLeft/Top` works in most browsers, except older WebKit-based ones, like Safari (bug [5991](https://bugs.webkit.org/show_bug.cgi?id=5991)), where we should use `document.body` instead of `document.documentElement`.
6666
6767
Luckily, we don't have to remember these peculiarities at all, because the scroll is available in the special properties `window.pageXOffset/pageYOffset`:
6868

0 commit comments

Comments
 (0)