gjtorikian / html-proofer

Test your rendered HTML files to make sure they're accurate.
MIT License
1.57k stars 199 forks source link

Srcsets - better handling of multiple srcsets #744

Closed fallax closed 2 years ago

fallax commented 2 years ago

The previous fix to #724 didn't handle this situation:

srcset="test.webp 1.5x, test2.webp 2x"

This PR should fix this, add a new test case, and hopefully remove some code duplication as a nice bonus.

gjtorikian commented 2 years ago

Oh, thanks very much! Releasing this as a patch update right now.

fallax commented 2 years ago

Looks like this still leaves a few issues. 'img' tags with multiple pixel density srcset attributes now work correctly - but 'source' tags don't.

I think this can be fixed by switching 'source' tags to being handled by the code in images.rb rather than the code in links.rb. I'm happy to contribute a PR to do this. Does that sound like a sensible approach to you? If so I'll get a second PR going...

gjtorikian commented 2 years ago

Sure, I can review the change and see what makes most sense then.