W3C home > Mailing lists > Public > whatwg@whatwg.org > December 2012

Re: [whatwg] what use-case is there for the name-attribute on a fieldset?

From: Ian Hickson <ian@hixie.ch>
Date: Fri, 21 Dec 2012 23:37:25 +0000 (UTC)
To: Evert Van dansen <evertvandansen@ymail.com>, Anne van Kesteren <annevk@annevk.nl>
Message-ID: <Pine.LNX.4.64.1212212332470.21222@ps20323.dreamhostps.com>
Cc: "whatwg@lists.whatwg.org" <whatwg@lists.whatwg.org>
On Fri, 21 Dec 2012, Evert Van dansen wrote:
>
> Recently I noticed that HTML5 allows the name-attribute on a fieldset. 
> This was not the case in HTML4.0.1.
> I did some tests and noticed that this name is *not* part of the POSTed 
> data when submitting a form? So I was wondering when and for what 
> purpose this name-attribute should or could be used?

On Fri, 21 Dec 2012, Anne van Kesteren wrote:
> 
> <!DOCTYPE html>
> <form><fieldset name=hah></fieldset></form>
> <script>alert(document.forms[0].hah)</script>

What Anne is saying here is just that this is what browsers already 
implemented. Specifically, forms but <fieldset> elements in their 
.elements array.

(When writing the contemporary HTML spec, I mostly ignored the HTML4 
spec, and based the new spec on what browsers did.)


On Fri, 21 Dec 2012, Evert Van dansen wrote:
> 
> I am sorry, perhaps I misunderstand, but I do not see what the advantage 
> is over using "regular" hooks (like id) in this case? Surely adding the 
> name-attribute must have been a decision based on something specific?

There's no advantage. In fact it is an entirely useless feature as far as 
I can tell. :-)

The name, type, willValidate, validity, validationMessage, checkValidity, 
and setCustomValidity features on fieldset are only there so that you can 
enumerate all the controls in a form.elements array and be confident that 
they will all have all those features, so you don't have to keep checking 
that it's not a fieldset each time.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Friday, 21 December 2012 23:37:54 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:50 UTC