Skip to content

Commit f3e3b44

Browse files
oolothm-allanson
authored andcommitted
Add two missing spaces (minor validation error) (#5150)
My previous commit missed adding a space after the backup blank `src=""` and `alt=""` attributes. This causes an HTML validation error when no `alt` value is supplied. This commit simply adds those missing spaces (i.e. `src="" ` and `alt="" `) so there will always be a space between attributes.
1 parent f35aee7 commit f3e3b44

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/gatsby-image/src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,11 @@ const isWebpSupported = () => {
9090
const noscriptImg = props => {
9191
// Check if prop exists before adding each attribute to the string output below to prevent
9292
// HTML validation issues caused by empty values like width="" and height=""
93-
const src = props.src ? `src="${props.src}" ` : `src=""` // required attribute
93+
const src = props.src ? `src="${props.src}" ` : `src="" ` // required attribute
9494
const srcSet = props.srcSet ? `srcset="${props.srcSet}" ` : ``
9595
const sizes = props.sizes ? `sizes="${props.sizes}" ` : ``
9696
const title = props.title ? `title="${props.title}" ` : ``
97-
const alt = props.alt ? `alt="${props.alt}" ` : `alt=""` // required attribute
97+
const alt = props.alt ? `alt="${props.alt}" ` : `alt="" ` // required attribute
9898
const width = props.width ? `width="${props.width}" ` : ``
9999
const height = props.height ? `height="${props.height}" ` : ``
100100
const opacity = props.opacity ? props.opacity : `1`

0 commit comments

Comments
 (0)