I just realized that 7.x-1.0-rc2 utilizes the core drupal_clean_css_identifier()
function to sanitize CSS-classes. There are lots of reasons why using the same sanitizer as core would be a good idea, but the result here is that BEM style CSS-classes are not possible to enter as list- and row class attributes (just to name two places). card__list-item
becomes card--list-item
, which means something entirely different in BEM lingo. There are a bunch of issues for both Views (https://www.drupal.org/node/1371118) and core (https://www.drupal.org/node/2009584 and https://www.drupal.org/node/1109854) where users are experiencing this issue.
drupal_clean_css_identifier()
in its current form prohibits modern, sane CSS-architectures, and since even the comments inside the function states that underscore is a valid character I'd label that as a serious bug (for front-end'ers at least). And since a fix for core won't happen until D8 at the earliest, my request is that semanticviews ”solve” this bug with it's own semanticviews_clean_css_identifier()
sanitation-function until a fix is committed to core.
My ”fix” for the time being is to use 7.x-1.0-alpha1
where from what I can tell there's no CSS class-sanitation in the same way as in 7.x-1.0-rc2
. But of course I'd prefer to use the latest and greatest version.
I'm sure I can supply a patch for this if this is something that the maintainers would consider.
Comment | File | Size | Author |
---|---|---|---|
#1 | 2427925-semanticviews-bem_style_css_classes.patch | 787 bytes | slv_ |
Comments
Comment #1
slv_ CreditAttribution: slv_ commentedHi. +1 to this.
Patch attached.
Comment #2
slv_ CreditAttribution: slv_ commentedProbably not needed any longer, as this is supported in core as of 7.51 (https://www.drupal.org/node/2810369).
Comment #3
Scyther CreditAttribution: Scyther commentedBecause core now supports it, this will not be changed in this module, it will still use drupal_clean_css_identifier()