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

Throws if the value of :lang() pseudo-class is quoted #265

Open
asamuzaK opened this issue Nov 5, 2023 · 0 comments
Open

Throws if the value of :lang() pseudo-class is quoted #265

asamuzaK opened this issue Nov 5, 2023 · 0 comments

Comments

@asamuzaK
Copy link

asamuzaK commented Nov 5, 2023

According to the spec: The Language Pseudo-class: :lang()

Each language range in :lang() must be a valid CSS <ident> or <string>. (Thus language ranges containing asterisks, for example, must be either correctly escaped or quoted as strings, e.g. :lang(*-Latn) or :lang("*-Latn").)

CSSTree throws if language ranges are quoted.

import { parse } from 'css-tree';
const ast = parse(':lang("*-Latn")', { context: 'selectorList' });
// throws `SyntaxError: Identifier is expected`

It succeeds if they are escaped, e.g. :lang(\*-Latn).

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