Fix srcset parsing when url contains commas#10
Merged
j0k3r merged 1 commit intofossar:masterfrom Jun 7, 2022
Merged
Conversation
We split the parsing logic in two separate steps: 1/ Get all candidates and loop over them 2/ Eject candidates with their descriptor is invalid Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
j0k3r
approved these changes
Jun 7, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This a new attempt to improve this painful parsing.
Before this PR, fetching https://www.wired.co.uk/article/energy-vault-gravity-storage would lead the first image to be broken.
We now split the parsing logic in two separate steps:
1/ Get all candidates and loop over them
2/ Eject candidates with their descriptor is invalid
It is not perfect though, standard is not fun.
Reference: https://html.spec.whatwg.org/#parse-a-srcset-attribute