A user account is required in order to edit this wiki, but we've had to disable public user registrations due to spam.

To request an account, ask an autoconfirmed user on IRC (such as one of these permanent autoconfirmed members) or send an e-mail to admin@wiki.whatwg.org with your desired username and an explanation of the first edit you'd like to make. (Do not use this e-mail address for any other inquiries, as they will be ignored or politely declined.)

Class

From WHATWG Wiki
Jump to: navigation, search

Misapprehensions (citations to follow) abound about the purpose of the class attribute, which is often referred to, plural, as "CSS classes".

The wording in the spec should be changed to more clearly indicate the semantic nature of the class attribute, when used properly, and indicate the validity of its use in this way.

Current wording

From: http://www.w3.org/TR/html5/elements.html#classes

Every HTML element may have a class attribute specified.

The attribute, if specified, must have a value that is a set of space-separated tokens representing the various classes that the element belongs to.

The classes that an HTML element has assigned to it consists of all the classes returned when the value of the class attribute is split on spaces. (Duplicates are ignored.)

Assigning classes to an element affects class matching in selectors in CSS, the getElementsByClassName() method in the DOM, and other such features.

There are no additional restrictions on the tokens authors can use in the class attribute, but authors are encouraged to use values that describe the nature of the content, rather than values that describe the desired presentation of the content.

Suggested wording

Please add and sign suggestions, so that a composite may be produced at later date. Emboldening may be used to identify changes, and will not be conveyed to the final version.

  • replace the final paragraph with...
    • There are no additional restrictions on the tokens authors can use in the class attribute, but authors are encouraged to use values that describe the semantic nature of the content, rather than values that describe the desired presentation of the content. Pigsonthewing 16:00, 11 August 2010 (UTC)

Prior discussion

Bug