views:

35

answers:

2

I couldn't find anything in the W3C docs that said pipe chars, |, aren't allowed, for instance:

<div class="class1|class2">

Don't worry about what I might be using it for. I was just wondering if it's "legal".

+1  A: 

It's legal HTML, since the datatype of class is CDATA. You will have a problem with CSS selectors, because the pipe is not a valid character for a selector.

Marc
+2  A: 

The relevant rules can be found in w3c syndata tokenization section, though it's pretty difficult to conclude from there if pipe is valid or not, as per a glance, it seems that anything is valid for a selector, i.e.:

selector    : any+;
any         : [ IDENT | NUMBER | PERCENTAGE | DIMENSION | STRING
              | DELIM | URI | HASH | UNICODE-RANGE | INCLUDES
              | DASHMATCH | ':' | FUNCTION S* any* ')' 
              | '(' S* any* ')' | '[' S* any* ']' ] S*;
azatoth
it looks like it is ok to use (ie, it's not "invalid") but like @marc said, it's not ok for selectors. which is ok for me because i'm not using it as one :)
Jason