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

Re: Alternate syntax for defining class attribute

From: T.J. Crowder <tj@crowdersoftware.com>
Date: Mon, 10 Aug 2009 10:29:05 +0100
Message-ID: <c95470a0908100229i6f5a8124v7fb06f28d99d6def@mail.gmail.com>
To: Max Romantschuk <max@romantschuk.fi>
Cc: public-html-comments@w3.org
Hi Max,

I'm quite familiar with CSS selectors, and I disagree.  Classes still
come up a lot.  I'm still making the suggestion.

-- T.J.



2009/8/10 Max Romantschuk <max@romantschuk.fi>:
> 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 Monday, 10 August 2009 09:30:04 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 1 June 2011 00:14:00 GMT