Skip to content

Commit

Permalink
Update files/en-us/web/html/global_attributes/class/index.md
Browse files Browse the repository at this point in the history
Co-authored-by: Joshua Chen <[email protected]>
  • Loading branch information
wbamberg and Josh-Cena authored Aug 1, 2024
1 parent 597355e commit 0f5f673
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion files/en-us/web/html/global_attributes/class/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ The `class` attribute is a list of class values separated by [ACSII whitespace](

Each class value may contain any Unicode characters (except, of course, ASCII whitespace). However, when used in CSS selectors, either from JavaScript using APIs like {{domxref("Document.querySelector()")}} or in CSS stylesheets, class attribute values must be valid [CSS identifiers](/en-US/docs/Web/CSS/ident). This means that if a class attribute value is not a valid CSS identifier (for example, `my?class` or `1234`) then it must be escaped before being used in a selector, either using the {{domxref("CSS.escape_static", "CSS.escape()")}} method or [manually](/en-US/docs/Web/CSS/ident#escaping_characters).

For this reason, it's recommended that developers choose values for class attributes that are valid CSS identifiers.
For this reason, it's recommended that developers choose values for class attributes that are valid CSS identifiers that don't require escaping.

## Specifications

Expand Down

0 comments on commit 0f5f673

Please sign in to comment.