Escapes a string for use in a CSS selector.
Uses the native CSS.escape when available (browsers), and falls back to a conservative escape for Node.js / SSR environments where CSS is undefined.
CSS.escape
CSS
The raw string to escape.
The escaped string, safe to embed in a CSS selector.
Escapes a string for use in a CSS selector.
Uses the native
CSS.escapewhen available (browsers), and falls back to a conservative escape for Node.js / SSR environments whereCSSis undefined.