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

Consume string token seems to have a bug with newlines #226

Open
romainmenke opened this issue Jan 2, 2023 · 2 comments
Open

Consume string token seems to have a bug with newlines #226

romainmenke opened this issue Jan 2, 2023 · 2 comments

Comments

@romainmenke
Copy link

romainmenke commented Jan 2, 2023

offset += getNewlineLength(source, offset, code);

That code appears to advance the offset.
It should only return a bad string token and make sure that the next tokenizing pass handles the newline.

https://www.w3.org/TR/css-syntax-3/#consume-string-token

Example :

"fo
o"
@lahmatiy
Copy link
Member

lahmatiy commented Jan 3, 2023

Good catch 👍 Agree, a newline must not be a part of bad-string-token. It's a bit tricky to fix it, since serialisation is affected as well. However, I almost done with it, but need to test better.

@romainmenke
Copy link
Author

fyi :

the CSS Tokenizer tests I was working on now also have a published corpus on npm : https://www.npmjs.com/package/@rmenke/css-tokenizer-tests

sharing these should make it easier to have multiple high quality css tokenizers :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants