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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add srcset attribute #9

Closed
wants to merge 3 commits into from
Closed

Add srcset attribute #9

wants to merge 3 commits into from

Conversation

Siilwyn
Copy link

@Siilwyn Siilwyn commented Nov 14, 2018

馃憢 hi @feross seems like this attribute is missing from conversion.

btw. I removed the trailing comma but with a trailing comma the git diff would be cleaner.

@feross
Copy link
Owner

feross commented Jul 20, 2019

@Siilwyn Thanks for the PR! Can you please share a link to the spec or any page that documents this property? I couldn't confirm that this attribute maps to the property you specified.

@Siilwyn
Copy link
Author

Siilwyn commented Jul 28, 2019

@feross Hi you're welcome! There is a detailed page on srcset at MDN: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-srcset

I got the transformation from srcset to srcSet by inspecting an image with the browser devtools and seeing $0.srcSet gives back the attribute value.

@feross
Copy link
Owner

feross commented Jul 29, 2019

I just tested with this code:

const img = document.createElement('img')
img.setAttribute('srcset', 'test')
console.log(1, img.srcset)
console.log(2, img.srcSet)

which outputs:

1 "test"
2 undefined

Are you sure that srcSet is the correct property name?

@Siilwyn
Copy link
Author

Siilwyn commented Jul 29, 2019

Ah my bad, this doesn't seem to match up. Now that I'm thinking back at this issue I remember this had something to do with React. 馃
I'll do some digging, perhaps React is just being the odd one for this attribute and it falls outside this project.

@feross
Copy link
Owner

feross commented Jul 29, 2019

Okay, no problem! I'll close this for now but do let me know if you discover that there's indeed a bug here :)

@feross feross closed this Jul 29, 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

2 participants