Bug#356315: [xml/sgml-pkgs] Bug#356315: checked="false" is changed to checked

Mike Hommey mh at glandium.org
Sun Mar 12 07:47:02 UTC 2006


On Sat, Mar 11, 2006 at 09:27:36PM -0500, Allan Wind <allan_wind at lifeintegrity.com> wrote:
> On 2006-03-11T22:25:29+0100, Mike Hommey wrote:
> > The "false" value for the checked attribute is wrong.
> 
> http://www.w3.org/TR/REC-html40/interact/forms.html#adef-checked
> indicate that checked is a boolean attribute, and
> http://www.w3.org/TR/REC-html40/intro/sgmltut.html#didx-boolean_attribute
> that true and false are valid values.  Absence of the attribute implies
> false.  So I beg to differ that the notation used is "wrong".

Quoting your URL:
  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".
  (...)
  The attribute is set to "true" by appearing in the element's start tag:
  <OPTION selected="selected">

The wording is maybe badly chosen, but it doesn't mean "true" or "false"
are valid values.

Take a look at the DTD definition of INPUT for checked:
http://www.w3.org/TR/REC-html40/interact/forms.html#edef-INPUT

  checked     (checked)      #IMPLIED  -- for radio buttons and check boxes --

That means the accepted value for checked is "checked" or nothing. Nothing
else is accepted.

See http://www.w3.org/TR/REC-html40/intro/sgmltut.html#h-3.3.4.

  "Whether the default value of the attribute is implicit (keyword
  "#IMPLIED"), in which case the default value must be supplied by the
  user agent"

That means that either you put the attribute with a value value, or omit
it in which case you get the default value (not really a value,
technically speaking), which is to not check the checkbox.

The semantics for the attribute possible value definition are the same
than that for the element declaration.
http://www.w3.org/TR/REC-html40/intro/sgmltut.html#h-3.3.3

  ( ... )
    Delimits a group.
  A
    A must occur, one time only.

Here we have (checked) which means a group for which "checked" must
occur (or not in which case you get the default behaviour).

An example of attribute that accepts several fixed values is given in
the element declaration section.

  valign      (top|middle|bottom|baseline) #IMPLIED

Which means a group for which either "top", "middle", "bottom" or
"baseline" must occur (or not in which case you get the default
behaviour). The | has the meaning defined in the element declaration
section:

  A | B
    Either A or B must occur, but not both.

Coming back to checked, if "true" and "false" were valid values, it
would have been defined as

  checked     (checked|true|false) #IMPLIED

> > The "html" output method follows the rules of HTML for output and will
> > not output something wrong HTML-wise. Use the "xml" output method if you
> > want to keep your (wrong) checked="false" attribute.
> 
> The problem is that it changes meaning of the data.  It would be fine if
> it omitted the attribute entirely.

It would be fine if you'd put valid data.

Mike




More information about the debian-xml-sgml-pkgs mailing list