[whatwg] Re: why, e.g., input/@checked="checked" ?

fantasai fantasai.lists at inkedblade.net
Thu Mar 31 01:32:35 PST 2005


Jukka K. Korpela wrote:
> On Sat, 26 Mar 2005, David Dorward wrote:
> 
> 
>>HTML was designed before XML, XSLT and XHTML were, so it didn't take
>>into consideration any design implications it would cause for them.
> 
> That's correct, but in this issue, it was also designed without really
> thinking in SGML terms. "Boolean attributes" (which are even called that
> way in HTML specifications) don't fit into SGML philosophy, although they
> were formally retrofitted into SGML formalism. It would be have been much
> more SGML-like to have an attribute that takes two values, like "checked"
> and "unchecked", the latter being the default, and the attribute name
> being 'status' for example.

What Jukka's trying to say is, attribute minimalization in SGML -- which
lets you do things like
   <input type="checkbox" checked>
doesn't let you leave out the name of the attribute -- it lets you leave
out the *value*. So, for example, I could use attribute minimalization to
shorten the 'type="checkbox"' part like so:
   <input checkbox checked>

An easy fix to make the 'checked' attribute more template-friendly would be
to introduce the 'unchecked' value Jukka suggests. Then you can use a
   checked="[test ? checked : unchecked]"
type of construction to set the attribute in XHTML.

~fantasai



More information about the whatwg mailing list