I love the new CSS class for views, however, when I try to add the class "grid_16" which is from my 960 grid system CSS file, I get the error "CSS classes must be alphanumeric or dashes only."

I think it's okay to have underscores in class names, right?

For now, I just added grid16 to my class, but I think this should be addressed if it's an easy fix.

CommentFileSizeAuthor
#8 939992-css-underscore.patch617 bytesdawehner
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner’s picture

Status: Active » Needs review
dagmar’s picture

Status: Needs review » Active

There is no patch to review here.

dawehner’s picture

regular expressions :)

-?(?:[_a-z]|[\200-\377]|\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?|\\[^\r\n\f0-9a-f])(?:[_a-z0-9-]|[\200-\377]|\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?|\\[^\r\n\f0-9a-f])*
lukus’s picture

+1 for underscores

pinch'’s picture

+1 for underscores

wanjee’s picture

+1 for underscores

Jej’s picture

+1 for underscores but also for spaces (left as spaces and not dashed)

dawehner’s picture

Status: Active » Needs review
FileSize
617 bytes

Here is a patch.

tibor.antaloczy’s picture

+1 for underscores

iamjon’s picture

Status needs review means that the module needs review. It would be nice if someone actually tested it.

lduerig’s picture

I applied the patch, great that I can enter underscores without errors, but it would be nice if they didn't get converted to dashes on the page. Anyone else get that?

lpalgarvio’s picture

Priority: Normal » Major

Underscores are valid for CSS class names. read these resources:
- http://stackoverflow.com/questions/448981/what-characters-are-valid-in-c...
- http://www.w3.org/TR/CSS21/syndata.html#characters
- http://www.w3.org/TR/CSS21/grammar.html#tokenizer-diffs

+1 for underscores. please add support.
for now i have to do massive class name renaming... :(

dagmar’s picture

Priority: Major » Normal

There are a "few" issues that needs review, please don't change the priority of an issue for a simple underscore addition in a css class. Be patient.

dawehner’s picture

You could have changed the priority of the issue if you would have reviewed/tested the patch :)

Pisco’s picture

Status: Needs review » Needs work

Thanks dereine, unfortunately your patch doesn't seem to solve the problem. In plugins/views_plugin_style.inc (function get_row_class) there's a call to drupal_clean_css_identifier which transliterates underscores to dashes. In my opinion drupal_clean_css_identifier should not replace underscores by default, I already filed an ticket for that: #1109854: Overly aggressive transliteration in drupal_clean_css_identifier removes underscores from classes. A workaround for the moment could be

$class = drupal_clean_css_identifier($class, array(' ' => '-', '/' => '-', '[' => '-', ']' => ''));
Pisco’s picture

Seems like drupal_clean_css_identifier will not be fixed anytime soon: #1109854: Overly aggressive transliteration in drupal_clean_css_identifier removes underscores from classes, so I'd recommend the aforementioned workaround.

dawehner’s picture

Status: Needs work » Needs review

@Pisco

This issue is about the validation itself. There is another issue on the views issue queeu which removes drupal_clean_css_identifier/let it use the right identifiers.

So change back the patch. In general this issue is marked against 6.x-3.x so it should be first fixed there.

Pisco’s picture

@dereine, you're right, sorry for the confusion with the versions. You were referring to #1032380: More than one wrapper class?

dawehner’s picture

Yeah exactly.

shadysamir’s picture

+1

dawehner’s picture

Status: Needs review » Fixed
Issue tags: +dvcs11

This change seemed to be already in 7.x-3.x so committed to 6.x-3.x only
Yeah another patch

Status: Fixed » Closed (fixed)
Issue tags: -dvcs11

Automatically closed -- issue fixed for 2 weeks with no activity.