Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

w descriptors that start with digits but end with non-digits (e.g. 100abcw) are considered valid #16

Open
azerum opened this issue Mar 15, 2024 · 0 comments

Comments

@azerum
Copy link

azerum commented Mar 15, 2024

Here's an example:

// [ { url: 'https://example.com', width: 100 } ]
console.log(parseSrcset('https://example.com 100abcw', { strict: true }))

Which seems to be pretty surprising. Is it intentional?

The spec I've found says that:

A width descriptor, consisting of: ASCII whitespace, a valid non-negative integer giving a number greater than zero representing the width descriptor value, and a U+0077 LATIN SMALL LETTER W character.

"Valid non-negative integer" is defined as

A string is a valid non-negative integer if it consists of one or more ASCII digits.

It seems like the definition implies that the string must consist only of digits

Maybe it's allowed due to rules for parsing integers?

@azerum azerum changed the title w specifer that start with digits but end with non-digits (e.g. 100abcw) are considered valid w descriptors that start with digits but end with non-digits (e.g. 100abcw) are considered valid Mar 15, 2024
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

No branches or pull requests

1 participant