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

feat(gatsby-image): Whitelist crossorigin prop for pass through to img tag #9758

Merged

Conversation

wconnorwalsh
Copy link
Contributor

The crossorigin prop is occasionally needed on the root img tag to enable CORS requests.

This PR passes that prop from Image to img, just as it already passes the alt and title props.

@wconnorwalsh wconnorwalsh changed the title [gatsby-image] Whitelist crossorigin prop for pass through to img tag feat(gatsby-image) Whitelist crossorigin prop for pass through to img tag Nov 7, 2018
@wconnorwalsh wconnorwalsh changed the title feat(gatsby-image) Whitelist crossorigin prop for pass through to img tag feat(gatsby-image): Whitelist crossorigin prop for pass through to img tag Nov 7, 2018
Copy link
Contributor

@DSchau DSchau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure - this seems reasonable.

More general question, since you just dived into the code. Does it make sense to stop maintaining this whitelist of valid image props, and rather be a little less selective and pluck the props we need, and pass others down appropriately?

In other words, there are several HTML attributes valid on the img tag and it may make more sense to just pass down and serialize appropriately, rather than explicitly handling each of these cases.

@wardpeet wardpeet self-assigned this Jan 11, 2019
@wardpeet
Copy link
Contributor

wardpeet commented Mar 15, 2019

lets revisit this in gatsby v3 where we can do lots of optimisations. I'll be merging this one

Copy link
Contributor

@wardpeet wardpeet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wardpeet
Copy link
Contributor

@wconnorwalsh thank you for your patience! This went way to long! thanks for adding this feature!

@wardpeet wardpeet merged commit 7684b4f into gatsbyjs:master Mar 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants