W3C home > Mailing lists > Public > public-html@w3.org > May 2007

Re: Predefined Class Names Solution (was: Re: Getting beyond the ping pong match)

From: Lachlan Hunt <lachlan.hunt@lachy.id.au>
Date: Mon, 07 May 2007 22:52:32 +1000
Message-ID: <463F2110.2030404@lachy.id.au>
To: Rene Saarsoo <nene@triin.net>
CC: public-html@w3.org

Rene Saarsoo wrote:
> Here are my objections agains predefined class names:
> 
> 
> 1. Many sites use those class names for something else
> 
>    I also recorded uses like the following:
> 
>    <span class="note">Note:</span> you can also add the...
> 
>    <input type="text" size="30" max="50" name="firstname">
>    <span class="note">optional</span>

Indeed, clashes with those class names that use words with multiple 
distinct meanings are far more of an issue than ones like copyright, 
which don't.

However, Microformats have been defining class values for quite a while 
now and have done so without significant problems, so there is a 
precedence for it.  They often work around the issue by defining names 
that aren't likely to be widely used before.  e.g. vcard, hcalendar, 
hresume, hfeed, etc.

The 'h' prefix for the root class names generally makes the class names 
unique enough to not cause problems.  However, they don't always do so. 
  e.g. There are proposals for the class="money" for a new currency format.

Gervase Markham suggested previously that we could use an an '_' prefix, 
which would solve the issue of clashes.  From a quick survey of 2,500 
pages, none of them used class names that began with an '_'.

The advantages of using an '_' instead of some other prefix are:

* Compatible with Selectors in a way that doesn't require escaping.
   e.g. ._copyright { ... }
* Consistent with predefined target values like _top, _parent, etc.
* Allows for future extensibility without worrying about clashes
   too much.
* Doesn't require the introduction of an additional attribute like
   role, which has its own problems like its reliance on qnames and
   RDF.

The disadvantage is that it doesn't directly pave the cowpath made by 
existing content, such as the wide use of class=copyright.

-- 
Lachlan Hunt
http://lachy.id.au/
Received on Monday, 7 May 2007 12:53:09 UTC

This archive was generated by hypermail 2.3.1 : Monday, 29 September 2014 09:38:44 UTC