-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Syntax simplification of CSS <source-size-list>
#8961
Conversation
@tabatkins is this equivalent? |
Note that parsing is defined here https://html.spec.whatwg.org/multipage/images.html#parsing-a-sizes-attribute The grammar is effectively only for conformance checking. |
Indeed. I created this issue after looking for occurrences of I take the opportunity of Tab's review to suggest a simplification (in another PR if needed).
|
Yes, the grammar is equivalent. We don't concern ourselves with what internal representation particular parsers might generate for themselves; the two are identical in terms of accept/reject sets. |
@tabatkins thanks! @cdoublev I'd rather not change the parsing algorithm, it was carefully written to behave as intended. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM but needs a rebase
Oups, I forgot to update the head before making this PR, sorry. Done. |
[<source-size-list>#,]? <source-size-value>
is nearly equivalent to<source-size-list>#? , <source-size-value>
. If you think this is not a breaking change, I propose the second syntax definition.The current syntax definition may predates comma-elision rules and
#?
.https://drafts.csswg.org/css-values-4/#comb-comma
https://drafts.csswg.org/css-values-4/#component-multipliers
However it can make a difference with grammar-driven parsers, which could produce different data representations:
list(list(commaList(...sourceSizes), comma), sourceSizeValue)
instead oflist(commaList(...sourceSizes), comma, sourceSizeValue)
list(omittedGroup, sourceSizeValue)
instead oflist(omittedGroup, omittedComma, sourceSizeValue])
The second results (from the proposed syntax) are simpler and more consistent.
/images.html ( diff )