Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove <noscript> from next/future/image #40075

Merged
merged 2 commits into from Aug 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 0 additions & 27 deletions packages/next/client/future/image.tsx
Expand Up @@ -134,7 +134,6 @@ type ImageElementProps = Omit<ImageProps, 'src' | 'loader'> & {
onLoadingCompleteRef: React.MutableRefObject<OnLoadingComplete | undefined>
setBlurComplete: (b: boolean) => void
setShowAltText: (b: boolean) => void
noscriptSizes: string | undefined
}

function getWidths(
Expand Down Expand Up @@ -343,7 +342,6 @@ const ImageElement = ({
setShowAltText,
onLoad,
onError,
noscriptSizes,
...rest
}: ImageElementProps) => {
loading = isLazy ? 'lazy' : loading
Expand Down Expand Up @@ -438,30 +436,6 @@ const ImageElement = ({
}
}}
/>
{placeholder === 'blur' && (
<noscript>
<img
{...rest}
{...generateImgAttrs({
config,
src: srcString,
unoptimized,
width: widthInt,
quality: qualityInt,
sizes: noscriptSizes,
loader,
})}
width={widthInt}
height={heightInt}
decoding="async"
data-nimg={`future${fill ? '-fill' : ''}`}
style={imgStyle}
className={className}
// @ts-ignore - TODO: upgrade to `@types/react@17`
loading={loading}
/>
</noscript>
)}
</>
)
}
Expand Down Expand Up @@ -884,7 +858,6 @@ export default function Image({
onLoadingCompleteRef,
setBlurComplete,
setShowAltText,
noscriptSizes: sizes,
...rest,
}
return (
Expand Down
9 changes: 0 additions & 9 deletions test/integration/image-future/default/test/index.test.ts
Expand Up @@ -1097,15 +1097,6 @@ function runTests(mode) {
)
})

it('should not use blurry placeholder for <noscript> image', async () => {
const html = await renderViaHTTP(appPort, '/blurry-placeholder')
const $html = cheerio.load(html)
const img = $html('noscript > img')[0]
expect(img).toBeDefined()
expect(img.attribs.id).toBe('blurry-placeholder-raw')
expect(img.attribs.style).toBe('color:transparent')
})

it('should remove blurry placeholder after image loads', async () => {
const browser = await webdriver(appPort, '/blurry-placeholder')
await check(
Expand Down
7 changes: 0 additions & 7 deletions test/integration/image-future/noscript/next.config.js

This file was deleted.

32 changes: 0 additions & 32 deletions test/integration/image-future/noscript/pages/index.js

This file was deleted.

54 changes: 0 additions & 54 deletions test/integration/image-future/noscript/test/index.test.ts

This file was deleted.