- From: Sebastian Mendel <lists@sebastianmendel.de>
- Date: Tue, 01 Jul 2008 09:39:56 +0200
- To: Benjamin Hawkes-Lewis <bhawkeslewis@googlemail.com>
- CC: Johannes Koch <koch@w3development.de>, www-html@w3.org
Benjamin Hawkes-Lewis schrieb: > > Sebastian Mendel wrote: >> isn't it common to use >> >> <input type="radio" name="color" value="red" /> >> <input type="radio" name="color" value="blue" /> >> >> or >> >> <input type="checkbox" name="color[]" value="red" /> >> <input type="checkbox" name="color[]" value="blue" /> > > Yes. > >> so isn't it confusing to say on other elements ID and NAME share same >> space and name has to be unique? > > No, since the spec as Johannes Koch quoted lists which elements this > rule applies to: > > [...] i know what the spec says, that why it is confusing, name is treated one time unique and another not > getElementsByName appears to apply to all of these: > > http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-71555259 > > Note there is, more helpfully perhaps, a getElementsById method. Also it is called getElementById(), without s there is always only one element with the given ID > In the case of form controls, values of ID and NAME may differ, for > example: > [...] yes, again, thats why it is confusing > The selected value is submitted to the server with fruit as the key, > e.g. fruit=orange. But the ID attribute uniquely identifies a particular > option and associates it with (technically one or more, but usually one) > LABEL element via the FOR attribute. i think i know how this works after since nearly 20 years doing web stuff >> so just thought deprecating name on some elements is the wrong way > > Only the use of NAME instead of ID has been deprecated (1 out of 4 above) not "the use of NAME instead of ID" but "the use of NAME" has deprecated > (X)HTML doesn't need another generic means of arbitrarily grouping > elements in a document (that's what CLASS is for) i do not agree > or uniquely identifying elements in a document (that's what ID is for). this is not the topic of this thrad > JavaScript libraries have plugged the gap in the W3C DOM by defining > getElementsByClassName functions, for example: > > http://developer.yahoo.com/yui/docs/YAHOO.util.Dom.html#method_getElementsByClassName i know this, mentioned in an earlier posting and their drawback > Browser implementors are beginning to add such functions to their DOM > implementations, for example: > > http://webkit.org/blog/153/webkit-gets-native-getelementsbyclassname/ > > The HTML5 draft proposes to standardize it: > > http://www.w3.org/html/wg/html5/#getelementsbyclassname nice to see, but i still see a difference between classes and names ... -- Sebastian Mendel
Received on Tuesday, 1 July 2008 07:39:07 UTC