Skip to content

Commit

Permalink
Add two missing spaces (minor validation error) (#5150)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ooloth authored and m-allanson committed Apr 27, 2018
1 parent f35aee7 commit f3e3b44
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/gatsby-image/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ const isWebpSupported = () => {
const noscriptImg = props => {
// Check if prop exists before adding each attribute to the string output below to prevent
// HTML validation issues caused by empty values like width="" and height=""
const src = props.src ? `src="${props.src}" ` : `src=""` // required attribute
const src = props.src ? `src="${props.src}" ` : `src="" ` // required attribute
const srcSet = props.srcSet ? `srcset="${props.srcSet}" ` : ``
const sizes = props.sizes ? `sizes="${props.sizes}" ` : ``
const title = props.title ? `title="${props.title}" ` : ``
const alt = props.alt ? `alt="${props.alt}" ` : `alt=""` // required attribute
const alt = props.alt ? `alt="${props.alt}" ` : `alt="" ` // required attribute
const width = props.width ? `width="${props.width}" ` : ``
const height = props.height ? `height="${props.height}" ` : ``
const opacity = props.opacity ? props.opacity : `1`
Expand Down

0 comments on commit f3e3b44

Please sign in to comment.