W3C home > Mailing lists > Public > public-html-comments@w3.org > August 2009

Re: Alternate syntax for defining class attribute

From: Max Romantschuk <max@romantschuk.fi>
Date: Mon, 10 Aug 2009 12:19:31 +0300
Message-ID: <4A7FE623.8020605@romantschuk.fi>
To: public-html-comments@w3.org
CC: tj@crowdersoftware.com
T.J. Crowder wrote:
> We use the class attribute a *lot*.  To save our poor fingers, not to
> mention reduce document sizes, would it be possible to introduce an
> alternate syntax for simple situations (one class) mirroring the basic
> CSS class selector syntax?  E.g., this:
>     <div class='nifty'>nifty stuff here</div>
> becomes
>     <div.nifty>nifty stuff here</div>

While the suggested syntax would undoubtedly be handy, I believe you're 
attacking the wrong problem.

The class attribute is seldom needed when the CSS selectors are used 
correctly withing a well structured document. Any browser that would 
support a feature like this already supports a wide array of CSS 
selectors allowing you to target any element in the document with only a 
fraction having a dedicated class.

I suggest reading up on CSS selectors:

Once you have realized that you don't really need classes that much it 
makes little or no sense to have a dedicated special case (which would 
complicate the parser a great deal) just as a shorthand for the class 

I suspect the easiest solution is using a suitable tool to set up a 
keyboard macro for adding 'class=""' into your source.


        Max Romantschuk
Received on Tuesday, 11 August 2009 21:08:25 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 20:03:57 UTC