diff --git a/snippets/elementIsVisibleInViewport.md b/snippets/elementIsVisibleInViewport.md index 448fd2088..b19632c42 100644 --- a/snippets/elementIsVisibleInViewport.md +++ b/snippets/elementIsVisibleInViewport.md @@ -7,7 +7,7 @@ lastUpdated: 2020-10-22T20:23:47+03:00 Checks if the element specified is visible in the viewport. -- Use `Element.getBoundingClientRect()` and the `Window.inner(Width|Height)` values to determine if a given element is visible in the viewport. +- Use `Element.getBoundingClientRect()`, `Window.innerWidth` and `Window.innerHeight` to determine if a given element is visible in the viewport. - Omit the second argument to determine if the element is entirely visible, or specify `true` to determine if it is partially visible. ```js diff --git a/snippets/getElementsBiggerThanViewport.md b/snippets/getElementsBiggerThanViewport.md index a5984279b..80fea6621 100644 --- a/snippets/getElementsBiggerThanViewport.md +++ b/snippets/getElementsBiggerThanViewport.md @@ -7,7 +7,7 @@ lastUpdated: 2020-10-22T20:23:47+03:00 Returns an array of HTML elements whose width is larger than that of the viewport's. -- Use `HTMLElement.offsetWidth` to get the width of the `document`. +- Use `HTMLElement.offsetWidth` to get the width of the `Document`. - Use `Array.prototype.filter()` on the result of `Document.querySelectorAll()` to check the width of all elements in the document. ```js diff --git a/snippets/getScrollPosition.md b/snippets/getScrollPosition.md index 369bcb416..6f35f77c0 100644 --- a/snippets/getScrollPosition.md +++ b/snippets/getScrollPosition.md @@ -8,7 +8,7 @@ lastUpdated: 2020-10-19T22:49:51+03:00 Returns the scroll position of the current page. - Use `Window.pageXOffset` and `Window.pageYOffset` if they are defined, otherwise `Element.scrollLeft` and `Element.scrollTop`. -- Omit the single argument, `el`, to use a default value of `window`. +- Omit the single argument, `el`, to use the global `Window` object. ```js const getScrollPosition = (el = window) => ({ diff --git a/snippets/isBrowser.md b/snippets/isBrowser.md index d5bec1ed5..39c09cc44 100644 --- a/snippets/isBrowser.md +++ b/snippets/isBrowser.md @@ -7,7 +7,7 @@ lastUpdated: 2020-10-20T23:02:01+03:00 Determines if the current runtime environment is a browser so that front-end modules can run on the server (Node) without throwing errors. -- Use `Array.prototype.includes()` on the `typeof` values of both `window` and `document` (globals usually only available in a browser environment unless they were explicitly defined), which will return `true` if one of them is `undefined`. +- Use `Array.prototype.includes()` on the `typeof` values of both `Window` and `Document` (globals usually only available in a browser environment unless they were explicitly defined), which will return `true` if one of them is `undefined`. - `typeof` allows globals to be checked for existence without throwing a `ReferenceError`. - If both of them are not `undefined`, then the current environment is assumed to be a browser. diff --git a/snippets/isLocalStorageEnabled.md b/snippets/isLocalStorageEnabled.md index d9a828652..2cc5d9c8e 100644 --- a/snippets/isLocalStorageEnabled.md +++ b/snippets/isLocalStorageEnabled.md @@ -8,7 +8,7 @@ lastUpdated: 2020-12-31T13:13:47+02:00 Checks if `localStorage` is enabled. - Use a `try...catch` block to return `true` if all operations complete successfully, `false` otherwise. -- Use `Storage.setItem()` and `Storage.removeItem()` to test storing and deleting a value in `window.localStorage`. +- Use `Storage.setItem()` and `Storage.removeItem()` to test storing and deleting a value in `Window.localStorage`. ```js const isLocalStorageEnabled = () => { diff --git a/snippets/isSessionStorageEnabled.md b/snippets/isSessionStorageEnabled.md index 9be6dd824..fc9f52bfe 100644 --- a/snippets/isSessionStorageEnabled.md +++ b/snippets/isSessionStorageEnabled.md @@ -8,7 +8,7 @@ lastUpdated: 2020-12-31T13:13:47+02:00 Checks if `sessionStorage` is enabled. - Use a `try...catch` block to return `true` if all operations complete successfully, `false` otherwise. -- Use `Storage.setItem()` and `Storage.removeItem()` to test storing and deleting a value in `window.sessionStorage`. +- Use `Storage.setItem()` and `Storage.removeItem()` to test storing and deleting a value in `Window.sessionStorage`. ```js const isSessionStorageEnabled = () => { diff --git a/snippets/supportsTouchEvents.md b/snippets/supportsTouchEvents.md index 2a5b6c25c..38d774f97 100644 --- a/snippets/supportsTouchEvents.md +++ b/snippets/supportsTouchEvents.md @@ -7,7 +7,7 @@ lastUpdated: 2020-10-22T20:24:30+03:00 Checks if touch events are supported. -- Check if `'ontouchstart'` exists in `window`. +- Check if `'ontouchstart'` exists in the `Window`. ```js const supportsTouchEvents = () =>