Re: Alternate syntax for defining class attribute

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.

Cheers,
Ryan



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