HTML – Why boolean attributes do not have boolean value?

In SGML, an attribute may be minimized so that its value alone is short for both the name and the value, with the only possible value for the attribute in this case obviously being the attribute’s own name. HTML uses this for boolean attributes, where the presence or absence of the attribute is what’s meaningful, and its value is irrelevant. But in XML, minimized attributes were disallowed, so we wound up with the awkwardness that is selected="selected" when XHTML came into vogue. If you’re writing HTML rather than XHTML, you can just write selected.

Leave a Comment