Skip to content

[css-syntax] Simplify ident-like URL consumption #5414

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

Closed
wants to merge 1 commit into from
Closed

[css-syntax] Simplify ident-like URL consumption #5414

wants to merge 1 commit into from

Conversation

jonathantneal
Copy link
Contributor

The specification reads:

While the next two input code points are whitespace, consume the next input code point.

If I understand correctly, this will repeatedly consume whitespace until 0 or 1 whitespace input code points remain.

Then it reads:

If the next one or two input code points U+0022 QUOTATION MARK ("), U+0027 APOSTROPHE ('), or whitespace followed by U+0022 QUOTATION MARK (") or U+0027 APOSTROPHE ('), then create a <function-token>...

Could this be simplified?

While the next input code point is whitespace, consume it. If the next input code point is a U+0022 QUOTATION MARK (") or U+0027 APOSTROPHE ('), then create a <function-token>...

@tabatkins
Copy link
Member

...huh, I have no idea why I wrote it that way.

@tabatkins
Copy link
Member

Ah, looking at the history, I changed from your suggested text to the current text in https://github.com/csstools/csswg-drafts/commit/5f673863c0b1195fc4b8933b2e4d3893b1f8eae0, and now that I see it, I understand why - if there is any whitespace between the open-paren and the string, I need to preserve it, so the next token produced is a whitespace token.

(I can't just emit the function-token immediately and let normal whitespace processing handle that; I need to scan forward and see if it's going to be a normal function (containing a string) or if it needs to be specially parsed as a url-token (unquoted).)

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