Generate gif as lowest priority source #193
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Because I think I'm facing the same issue as #164, I updated @iamschulz's PR with tests and I'll respond to #164#issuecomment-1409449689 here:
My options are:
The markup I got was this for a gif (line breaks added for readability):
The problem is that this puts the gif
<source>
ahead of the webp<img>
fallback, which causes the user agent to prefer the gif version. This image was not downsampled, so no webp<source>
was produced, but when it is produced, the order looks like this:<source>
<source>
<img>
I would prefer:
<source>
<source>
<img>
As this would allow browsers that don't support
<picture>
and browsers that don't support webp to both fall back on gif while preferring webp in all other cases.I noticed that the test that this change break is really testing for the
Could not find the lowest <img> source for responsive markup for undefined
branch so I re-added a specific test for that to replace the gif-specific behavior test.