Skip to content

Commit 1b626ec

Browse files
committed
refactor: implementing XOs suggestion
unicorn/no-typeof-undefined
1 parent 07c53a0 commit 1b626ec

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/loading-attribute-polyfill.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ function onIntersection(entries, observer) {
120120
* Handle printing the page
121121
*/
122122
function onPrinting() {
123-
if (typeof window.matchMedia === 'undefined') {
123+
if (window.matchMedia === undefined) {
124124
return;
125125
}
126126

@@ -170,7 +170,7 @@ function getAndPrepareHTMLCode(noScriptTag) {
170170
capabilities.scrolling
171171
) {
172172
// Check for IntersectionObserver support
173-
if (typeof intersectionObserver === 'undefined') {
173+
if (intersectionObserver === undefined) {
174174
// Attach abandonned attribute 'lazyload' to the HTML tags on browsers w/o IntersectionObserver being available
175175
lazyAreaHtml = lazyAreaHtml.replace(
176176
/(?:\r\n|\r|\n|\t| )src=/g,
@@ -214,7 +214,7 @@ function prepareElement(noScriptTag) {
214214

215215
if (
216216
capabilities.scrolling &&
217-
typeof intersectionObserver !== 'undefined' &&
217+
intersectionObserver !== undefined &&
218218
actualChild.tagName &&
219219
(((actualChild.tagName.toLowerCase() === 'img' ||
220220
actualChild.tagName.toLowerCase() === 'picture') &&

0 commit comments

Comments
 (0)