Re: [css-selectors][css-syntax] HTML5 Attribute names in CSS?

On Mon, Jul 1, 2013 at 12:48 PM, François REMY
<francois.remy.dev@outlook.com> wrote:
> In HTML5, attribute names like <div data-x{32}=”17” data-a.b=”21”> are
> totally valid but not usable in CSS (which only accepts IDENTS). Wouldn’t it
> be good to change the syntax of attribute selectors to better reflect the
> attribute syntax of HTML5?
>
> (my usecase was to create human-readable computed data attributes like
> “data-user.isAdmin” and use them in my CSS)

[data-x\{32\}="17"], [data-a\.b="21"], etc.

If you want them to be readable in all three languages, stick to the
intersection of their values - a-z, 0-9, and underscore.  For data-*
attributes specifically, you can use dash as well, since DOM handles
that in a way that works better with JS.

~TJ

Received on Monday, 1 July 2013 20:01:56 UTC