Re: [whatwg] HTML syntax: shortcuts for 'id' and 'class' attributes

Andrew Fedoniouk wrote:
> While we are on the subject of discussing HTML syntax....
> 
> How about following (wild) idea?
> 
> To allow following notation (borrowed from CSS selectors):
> 
> <p.myclass>...</p> is equivalent of 
> <p class="myclass">...</p> 
> 
> <p#myid>...</p> is equivalent of 
> <p id="myid">...</p> 
> 
> <p.myclass1.myclass2>...</p> is equivalent of 
> <p class="myclass1 myclass2">...</p> 
> 
> <p#myid.myclass1.myclass2>...</p> is equivalent of 
> <p id="myid" class="myclass1 myclass2">...</p> 
> 
> It is syntax sugar of course but at least it will reduce amount of data 
> needs to be sent over the wire.

   Okay, here's what's wrong:

1) Wrong mailing list.

2) Requires you to know two languages to write HTML instead of one.

3) It probably violates XML, so I'm guessing it can't be done in XHTML.

4) It's not backwards compatible with HTML 4.01.

5) People who are still learning HTML and have a programming background
will confuse the element name and all but the last class name for
namespaces.

6) It would take thousands of elements with IDs and/or class names to
make the savings in file size non-trivial. (You could save just as many
characters per page by making the |alt| attribute optional on <img>
elements.)

7) People will be tempted to use other CSS Selectors syntax in markup.
(Or do so out of plain confusion.)

8) The lack of whitespace makes the markup harder to read.

   I'm about to go to sleep, so that's all I can think of for now.

Received on Friday, 1 December 2006 02:41:09 UTC