Some Corrections

Fix javascript-tutorial#2090 - Spelling Mistake
Close javascript-tutorial#2079 - Remove 'elem' from `elem.scrollLeft/scrollTop`
This commit is contained in:
MuhammedZakir 2020-09-11 13:07:06 +05:30
parent 9f686c90ce
commit 14b50caf41
2 changed files with 5 additions and 5 deletions

View file

@ -60,11 +60,11 @@ Why so? Better don't ask. These inconsistencies come from ancient times, not a "
## Get the current scroll [#page-scroll] ## Get the current scroll [#page-scroll]
DOM elements have their current scroll state in `elem.scrollLeft/scrollTop`. DOM elements have their current scroll state in their `scrollLeft/scrollTop` properties.
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`. 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`.
Luckily, we don't have to remember these peculiarities at all, because the scroll is available in the special properties `window.pageXOffset/pageYOffset`: Luckily, we don't have to remember these peculiarities at all, because the scroll is available in the special properties, `window.pageXOffset/pageYOffset`:
```js run ```js run
alert('Current scroll from the top: ' + window.pageYOffset); alert('Current scroll from the top: ' + window.pageYOffset);

View file

@ -235,7 +235,7 @@ let dataView = new DataView(buffer);
// get 8-bit number at offset 0 // get 8-bit number at offset 0
alert( dataView.getUint8(0) ); // 255 alert( dataView.getUint8(0) ); // 255
// now get 16-bit number at offset 0, it consists of 2 bytes, together iterpreted as 65535 // now get 16-bit number at offset 0, it consists of 2 bytes, together interpreted as 65535
alert( dataView.getUint16(0) ); // 65535 (biggest 16-bit unsigned int) alert( dataView.getUint16(0) ); // 65535 (biggest 16-bit unsigned int)
// get 32-bit number at offset 0 // get 32-bit number at offset 0
@ -244,7 +244,7 @@ alert( dataView.getUint32(0) ); // 4294967295 (biggest 32-bit unsigned int)
dataView.setUint32(0, 0); // set 4-byte number to zero, thus setting all bytes to 0 dataView.setUint32(0, 0); // set 4-byte number to zero, thus setting all bytes to 0
``` ```
`DataView` is great when we store mixed-format data in the same buffer. E.g we store a sequence of pairs (16-bit integer, 32-bit float). Then `DataView` allows to access them easily. `DataView` is great when we store mixed-format data in the same buffer. For example, when we store a sequence of pairs (16-bit integer, 32-bit float), `DataView` allows to access them easily.
## Summary ## Summary