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

Re: Alternate syntax for defining class attribute

From: Ryan Roberts <hello@ryanroberts.co.uk>
Date: Mon, 10 Aug 2009 11:30:14 +0100
Message-ID: <4A7FF6B6.9020206@ryanroberts.co.uk>
To: "T.J. Crowder" <tj@crowdersoftware.com>
CC: public-html-comments@w3.org
Hi T.J.

HTML5 aims to be backward compatible as far as possible, but your 
suggest would not be backward compatible. The only benefit I can see 
here is saving a few characters, the suggestion also breaks from the 
standard HTML syntax. The negative implications of implementing this 
suggestion would far outweigh any benefits.

Sorry but I can't see it being taken on board.


T.J. Crowder wrote:
> Hello,
> First off, thank you for all of your work hammering out HTML5.
> Greatly appreciated!
> I have a suggestion which may be too late for HTML5 or not in keeping
> with the philosophy, but I'll give it a go:
> 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>
> Seems to me this is easily parsed and not a significant burden to
> implementors, whereas I think most authors would be thrilled to have
> the syntax line up with CSS and to stop typing "class='" all over the
> place.
> This is an alternate, not a replacement.  If one needs multiple class
> names, for example, one would use the original syntax.  Now, it would
> be nice to be able do something like this:
>      <div."nifty stuff">nifty stuff here</div>
> ....if people who know more about parsers than I (their numbers are
> legion) say that the optional quotes aren't hard to deal with.
> Obviously the caveat would be that if you send this alternate form to
> a UA that doesn't understand HTML5, it's not going to be a happy
> bunny.  Caveat author.
> Alternatively (no pun), a less easily-parsed version that doesn't seem
> to break the small number of UAs I tried (all browsers: IE7, FF3,
> Safari3win, Opera9, Chrome2) too badly is to allow whitespace between
> the tag and the dot:
>      <div .nifty>nifty stuff here</div>
> Older browsers wouldn't see the class name, obviously, but they seem
> to mostly ignore the invalid attribute.  I don't like this becaue it
> looks like a parsing nightmare to me, although as I said, I'm not a
> parser guy.
> Apologies if this is a duplicate.  A couple of archive searches didn't
> turn it up, but there are probably 18 ways to phrase this.
> Thanks for listening,
> --
> T.J. Crowder
> tj / crowder software / com

Web Designer

Web: http://ryanroberts.co.uk

Email: hello@ryanroberts.co.uk

Phone: 07759 917 964
Received on Monday, 10 August 2009 10:30:56 UTC

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