W3C home > Mailing lists > Public > public-html-bugzilla@w3.org > March 2011

[Bug 12301] Make empty-named radio buttons not belong to a group

From: <bugzilla@jessica.w3.org>
Date: Wed, 16 Mar 2011 20:29:06 +0000
To: public-html-bugzilla@w3.org
Message-Id: <E1PzxL8-0000zA-0K@jessica.w3.org>
http://www.w3.org/Bugs/Public/show_bug.cgi?id=12301

--- Comment #1 from Mounir Lamouri <mounir.lamouri@gmail.com> 2011-03-16 20:29:05 UTC ---
(In reply to comment #0)
> In most regards, the <input> element treats an empty name the same as the lack
> of a name.
> 
> This is true for example during form submission, and weather the element shows
> up in the form.elements collection.

I disagree. It seems that, in general, attributes in HTML are not ignored when
they are equals to the empty string. For example, "<a href=''>foo</a>" is far
different from "<a>foo</a>" and "<input pattern=''>" from "<input>".
The two examples you took are two exceptions because we *need* the string to
not be empty. It doesn't really make sense to submit something if there is no
name to identify it and the empty string isn't a real identifier. For the
form.elements, elements with the empty string are in that collection but you
can't access them with this form: form.elements.name given that
"form.elements." would make no sense. Even, according to the specs,
form.elements.namedItem("") should return element(s) with name="".

> Firefox 3.6 does what the spec currently prescribes.
> Firefox 4 puts empty-named radio buttons in no group. (Disclosure, this change
> was made by me, though I don't remember if it was an intentional change or not.
> It could have been a side effect of some code cleanup).
> Webkit puts empty-named radio buttons in no group.
> 
> Don't have Opera or IE at hand to try, but [1] indicates that Opera and IE6
> behave like Firefox 3.6 whereas IE9 behave like Firefox 4 and webkit.

Given that IE6, Firefox prior to 4 and Opera are accepting name='' as a group,
we do agree that there is no compat issue here?
If that is the case, assuming there is no consistency to keep with name='', I
think it would be better to keep what the specs currently say just for the ease
of implementation: it seems easier to check if a radio button is in a group by
checking if it has a name attribute than checking if the name attribute is
different from the empty string. In addition, it's a simple way to let authors
create a non-submittable radio group (though, I guess no one does that).

-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
Received on Wednesday, 16 March 2011 20:29:07 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 16 March 2011 20:29:13 GMT