Skip to content

srcset with no space after the comma #1

@EyalSi

Description

@EyalSi

I'm trying to understand if this is the correct behavior - when there is no space after the comma the parsing fails.
The following will fail with 'Invalid srcset descriptor':

srcset.parse("banner-HD.jpg 2x,banner-phone.jpg 100w");

Due to the regular expression in the code: string.split(/,\s+/)

Changing to string.split(/,\s*/)

Will fix the problem.

Is that on purpose?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions