Unverified Commit d04186e4 authored by Steven's avatar Steven Committed by GitHub

Fix lazy loaded images on IE 11 when no IntersectionObserver detected (#18868)

Fixes #18827 so that lazy loading does not break IE 11.
parent 4dbb65d0
...@@ -311,11 +311,6 @@ export default function Image({ ...@@ -311,11 +311,6 @@ export default function Image({
lazy = true lazy = true
} }
if (typeof window !== 'undefined' && !window.IntersectionObserver) {
// Rendering client side on browser without intersection observer
lazy = false
}
if (src && src.startsWith('data:')) { if (src && src.startsWith('data:')) {
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs // https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs
unoptimized = true unoptimized = true
...@@ -324,9 +319,8 @@ export default function Image({ ...@@ -324,9 +319,8 @@ export default function Image({
useEffect(() => { useEffect(() => {
const target = thisEl.current const target = thisEl.current
if (target) {
if (target && lazy) { const observer = lazy && getObserver()
const observer = getObserver()
if (observer) { if (observer) {
observer.observe(target) observer.observe(target)
...@@ -335,7 +329,6 @@ export default function Image({ ...@@ -335,7 +329,6 @@ export default function Image({
observer.unobserve(target) observer.unobserve(target)
} }
} else { } else {
//browsers without intersection observer
unLazifyImage(target) unLazifyImage(target)
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment