Re: Alternate syntax for defining class attribute

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:
http://www.w3.org/TR/CSS2/selector.html


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 
attribute.

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


   Regards,
Max

-- 
        Max Romantschuk
        max@romantschuk.fi
http://max.romantschuk.fi/

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