Overly aggressive transliteration in drupal_clean_css_identifier removes underscores from classes

Created on 29 March 2011, over 14 years ago
Updated 8 August 2025, 9 days ago

As described in the referenced spec, the underscore is a perfectly valid and widely used character in CSS identifiers. drupal_clean_css_identifier should not transliterate underscores by default! Even the comments in the code say that the underscore is a valid character.

🐛 Bug report
Status

Closed: duplicate

Version

7.0 ⚰️

Component

theme system

Created by

🇨🇭Switzerland Pisco

Live updates comments and jobs are added and updated live.
  • CSS

    It involves the content or handling of Cascading Style Sheets.

  • VDC

    Related to the Views in Drupal Core initiative.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇩🇰Denmark ressa Copenhagen

    You're right @mlncn, a single underscore is changed into a dash in Views classes in Drupal 11, and I just updated an issue about this. It looks like it's intentional, and not a bug, so documentation is perhaps the solution?

Production build 0.71.5 2024