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

Add data-nimg attribute to image component #27899

Merged
merged 6 commits into from
Aug 11, 2021
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/next/client/image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,7 @@ export default function Image({
loader,
})}
decoding="async"
data-nimg
style={imgStyle}
className={className}
/>
Expand All @@ -616,6 +617,7 @@ export default function Image({
{...rest}
{...imgAttributes}
decoding="async"
data-nimg
className={className}
ref={(img) => {
setRef(img)
Expand All @@ -640,9 +642,9 @@ export default function Image({
rel="preload"
as="image"
href={imgAttributes.srcSet ? undefined : imgAttributes.src}
// @ts-ignore: imagesrcset is not yet in the link element type
// @ts-ignore: imagesrcset is not yet in the link element type.
imagesrcset={imgAttributes.srcSet}
// @ts-ignore: imagesizes is not yet in the link element type
// @ts-ignore: imagesizes is not yet in the link element type.
imagesizes={imgAttributes.sizes}
></link>
</Head>
Expand Down