[whatwg] The form attribute (Association of controls and forms)

Hi,

"4.10.18 Association of controls and forms" explains the link between
forms and form-associated elements (and the form attribute). However,
I've the feeling the specifications go far over what should be done and
force the implementor how to do it.
What I mean is, this could be summarized like this: "If the form
attribute is specified, the form owner of the element is the first form
in the Document with the id corresponding of the form attribute value,
if any. If the form attribute content is not a form element id, the
element has no form owner. If the form attribute isn't specificed, the
element form owner is the nearest ancestor form."

However, the specification say (not only):
"When a form-associated element's ancestor chain changes, e.g. because
it or one of its ancestors was inserted or removed from a Document, then
the user agent must reset the form owner of that element.

When a form-associated element's form attribute is added, removed, or
has its value changed, then the user agent must reset the form owner of
that element.

When a form-associated element has a form attribute and the ID of any of
the elements in the Document changes, then the user agent must reset the
form owner of that form-associated element.

When a form-associated element has a form attribute and an element with
an ID is inserted into or removed from the Document, then the user agent
must reset the form owner of that form-associated element."

These sentences explain more than "what should be the form owner" but
explain how to implement it. It seems useless and maybe not needed
sometimes (I'm wondering if checking for the ID wouldn't be better than
observing all the element's ID change and insertion/removal).

In my opinion, the form attribute behaves more or less like the for
attribute for the label element so I'm wondering why the specification
is so different. Is there a reason I'm missing ?

Thanks,
--
Mounir

Received on Thursday, 13 May 2010 17:53:36 UTC