- From: Ian Hickson <ian@hixie.ch>
- Date: Fri, 14 Aug 2009 23:14:19 +0000 (UTC)
- To: "T.J. Crowder" <tj@crowdersoftware.com>, Max Romantschuk <max@romantschuk.fi>, Ryan Roberts <hello@ryanroberts.co.uk>
- Cc: public-html-comments@w3.org
On Sun, 9 Aug 2009, T.J. Crowder wrote: > > First off, thank you for all of your work hammering out HTML5. Greatly > appreciated! Thanks! > 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. We've looked at doing this before, but it has a very poor backwards- compatibility story, unfortunately. I would encourage you to find ways to avoid using class attributes, e.g. by writing selectors that are based on the structure of the document. For example, instead of: <h1>...</h1> <p class="firstp">...</p> p.firstp { ... } ...do something like: <h1>...</h1> <p>...</p> h1 + p { ... } > 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. It wouldn't be that hard to parse, but it would only say you a 5 keystrokes, and all the old browsers would miss the class attribute, so it's not really worth it, I think. Cheers, -- Ian Hickson U+1047E )\._.,--....,'``. fL http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,. Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
Received on Friday, 14 August 2009 23:14:56 UTC