Skip to main content

Day 46 of 100DaysOfSpec, The dir attribute

I am reading and taking notes on the HTML specifications for 100 days as part of #The100DayProject. Read the initial intent/backstory. I am a Microsoft employee but all opinions, comments, etc on this site are my own. I do not speak on behalf of my employer, and thus no comments should be taken as representative of Microsoft's official opinion of the spec. Subsections not listed below were read without comment.

Currently reading in 3.2.5 Global attributes

[3.2.5.7](link: https://www.w3.org/TR/html5/dom.html#classes) The class attribute

Ah, finally the meaning of “tokens” is clarified! The class attribute is a “set of space-separated tokens”, making each “class” a token. So in my very professional definition, an individual nugget (“word”) of text instead a string. ;]

Duplicates are ignored when returning individual classes from the attribute.

The spec states “there are no additional restrictions on the tokens authors can use in the class attribute” other than being space-separated. I still can’t apply styles using CSS to classes led with an integer (1, 2, 3, 4), at least in Chrome. So either that’s missing from the documentation, a requirement in the CSS specs (there’s no one document anymore), or a bug/design decision on the part of one or more browsers. Gotta get my giant spy magnifying glass out.

Like many/most leading front-end devs, the spec urges semantic class naming (.button--primary), as opposed to presentational (.blue).

Responses

My blog uses Webmentions. Responses from sites which likewise support Webmentions, such as Twitter or people’s personal sites, will show up here.

No Webmentions have been sent to this post yet.