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

What characters are allowed in a class name? #34253

Open
boxcleverliam opened this issue Jun 18, 2024 · 1 comment
Open

What characters are allowed in a class name? #34253

boxcleverliam opened this issue Jun 18, 2024 · 1 comment
Labels
Content:HTML Hypertext Markup Language docs help wanted If you know something about this topic, we would love your help!

Comments

@boxcleverliam
Copy link
Contributor

MDN URL

https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class

What specific section or headline is this issue about?

The main discription of the class attribute

What information was incorrect, unhelpful, or incomplete?

I think that "space-separated list" is not a clear enough description of what the value can be. Can it include any non-space unicode character? There is a link to the specification, but it is necessary to follow a second link after that to find this information.

What did you expect to see?

The actual rules, plus some guidance on best practices.
For example:
A space-separated list of tokens, each consisting of any character other than a space. For maximum compatibility, it may be recommended to use only letters, numbers, dashes and underscores.

Do you have any supporting links, references, or citations?

Link in article to spec: https://html.spec.whatwg.org/multipage/dom.html#global-attributes:classes-2
Extra links found in the spec, when read together gives a more complete answer
https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#set-of-space-separated-tokens
https://infra.spec.whatwg.org/#ascii-whitespace

Do you have anything more you want to share?

I encountered the class name "N/A" in the wild, and I came to MDN to find out if it is a valid class name.

MDN metadata

Page report details
@boxcleverliam boxcleverliam added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Jun 18, 2024
@github-actions github-actions bot added the Content:HTML Hypertext Markup Language docs label Jun 18, 2024
@Josh-Cena
Copy link
Member

#28752 is very related. Short answer is most characters are accepted but some make your life harder. Long answer should be put into the docs.

@Josh-Cena Josh-Cena added help wanted If you know something about this topic, we would love your help! and removed needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. labels Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:HTML Hypertext Markup Language docs help wanted If you know something about this topic, we would love your help!
Projects
None yet
Development

No branches or pull requests

2 participants