Re: HTML attribute with no value

In the specs for HTML 4.0, section 3.3.4, I have found the following. Note 
that it only addresses omitted value for boolean attributes. I have not 
found anything for other types of attributes.  I may have missed.

<quote>
Boolean attributes

Some attributes play the role of boolean variables (e.g., the selected
attribute for the OPTION element). Their appearance in the start tag of an
element implies that the value of the attribute is "true". Their absence
implies a value of "false".

Boolean attributes may legally take a single value: the name of the
attribute itself (e.g., selected="selected").

This example defines the selected attribute to be a boolean attribute.

selected     (selected)  #IMPLIED  -- reduced inter-item spacing --

The attribute is set to "true" by appearing in the element's start tag:

<OPTION selected="selected">
...contents...
<OPTION>

In HTML, boolean attributes may be appear in minimized form -- the
attribute's value appears alone in the element's start tag. Thus, selected
may be set by writing:

<OPTION selected>

instead of:

<OPTION selected="selected">

Authors should be aware than many user agents only recognize the minimized
form of boolean attributes and not the full form. 
<end of quote>


Shalom (Regards),  Mati
           Bidi Architect
           Globalization Center Of Competency - Bidirectional Scripts
           IBM Israel
           Phone: +972 2 5888802    Fax: +972 2 5870333    Mobile: +972 52 
2554160




From:   "Aharon (Vladimir) Lanin" <aharon@google.com>
To:     Tab Atkins <tabatkins@google.com>, public-i18n-bidi@w3.org
Date:   19/09/2010 16:25
Subject:        HTML attribute with no value
Sent by:        public-i18n-bidi-request@w3.org



In the f2f, we said:

ubi syntax is ubi=”ubi”|””|”off”. The “ubi” and empty string values are 
equivalent, and mean that bidi isolation is on for the element.

I am confused about why we needed two values meaning "on", and if so, why 
neither one of them is named "on".

The crux of my question is what, exactly, does the HTML spec say about an 
attributes with no value, e.g. <span foo>? Is it always equivalent to 
<span foo=foo>, or to <span foo="">, or something else?

If <span foo> is equivalent to <span foo=foo>, I do not see why we need an 
empty string value.

If, on the other hand, <span foo> is equivalent to <span foo="">, I 
understand why we need an empty value as well as an equivalent non-empty 
value, but I do not understand why the latter has to be the meaningless 
"ubi". I would prefer ubi=”on”|””|”off”.

Aharon

Received on Sunday, 19 September 2010 15:02:49 UTC