Skip to content

Fix srcset parsing when url contains commas#10

Merged
j0k3r merged 1 commit intofossar:masterfrom
Kdecherf:fix/srcset
Jun 7, 2022
Merged

Fix srcset parsing when url contains commas#10
j0k3r merged 1 commit intofossar:masterfrom
Kdecherf:fix/srcset

Conversation

@Kdecherf
Copy link

@Kdecherf Kdecherf commented Jun 5, 2022

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

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>
@Kdecherf Kdecherf requested review from j0k3r and jtojnar June 5, 2022 23:16
@j0k3r j0k3r merged commit 5bd4ce8 into fossar:master Jun 7, 2022
@Kdecherf Kdecherf deleted the fix/srcset branch June 7, 2022 12:28
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.

2 participants