[whatwg] Use cases for Node.getElementById

Calogero Alex Baldacchino alex.baldacchino at email.it
Wed Dec 10 11:21:21 PST 2008


Garrett Smith ha scritto:
> On Wed, Dec 10, 2008 at 8:10 AM, Calogero Alex Baldacchino
> <alex.baldacchino at email.it> wrote:
>   
>> Garrett Smith ha scritto:
>>     
>>> On Sat, Dec 6, 2008 at 7:09 PM, Calogero Alex Baldacchino
>>> <alex.baldacchino at email.it> wrote:
>>>
>>>       
>>>> Simon Pieters ha scritto:
>>>>
>>>>         
>>>>> On Fri, 05 Dec 2008 19:19:04 +0100, Calogero Alex Baldacchino
>>>>> <alex.baldacchino at email.it> wrote:
>>>>>
>>>>>
>>>>>           
>>>>>> [...]
>>>>>>
>>>>>>             
>>>>> (I'm currently the editor of that proposal, currently located at
>>>>> http://simon.html5.org/specs/web-dom-core )
>>>>>
>>>>>
>>>>>           
>>>> I'm reading it :-)
>>>>
>>>> And I have a few questions.
>>>>
>>>>         
>>> I did not see a proposal for Element.getElementById.
>>>
>>> I would not care about that much.
>>>
>>> I woud rather have
>>>
>>> Element.getElementsByName.
>>>
>>> It is perfectly valid for a doucment to have multiple elements w/the
>>> same name (though not generally a good idea). I've seen this before.
>>>
>>> Was this proposed?
>>>
>>> Garrett
>>>
>>>       
>> I don't remember what spec exactly stated this first, but I remind of a
>> previous HTML version declaring the 'name' attribute as unique in the
>> 'global scope' (or something like that),
>>     
>
> What?
>
>   
>> meaning the whole document; then, I
>> remember 'name' was deprecated in favour of 'id'.
>>     
>
> Name is not deprecated. It is, as I said, "perfectly valid". How else
> are you going to submit form values?
>
> Garrett
>   

I was referring to some elements using it as a global identifier, like 
<a> and <img>, and apologize for any lack of clearness.

 From http://www.w3.org/TR/html401/struct/links.html#adef-name-A

"This attribute names the current anchor so that it may be the 
destination of another link. The value of this attribute must be a 
unique anchor name. The scope of this name is the current document. Note 
that this attribute shares the same name space as the id attribute" 
<http://www.w3.org/TR/html401/struct/global.html#adef-id>

 From http://www.w3.org/TR/html401/struct/objects.html#adef-name-IMG

"This attribute names the element so that it may be referred to from 
style sheets or scripts. Note.** This attribute has been included for 
backwards compatibility. Applications should use the id attribute to 
identify elements"

 From http://www.w3.org/TR/html401/struct/links.html#anchors-with-id

"The id and name attributes share the same namespace.This means that 
they cannot both define an anchor with the same name in the same 
document. It is permissible to use both attributes to specify an 
element's unique identifier for the following elements: A, APPLET, FORM, 
FRAME, IFRAME, IMG and MAP. When both attributes are used on a single 
element, their values must be identical."

You'll find neither html 4.01, nor html 5 declare a 'name' attribute for 
every element (some of html 5 elements have lost their older 'name' 
attribute, though it might be handled by the parser for backwards 
compatibility, i.e. for the <a> element representing a fragment of the 
document).
 
 
 --
 Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e SMTP autenticato? GRATIS solo con Email.it http://www.email.it/f
 
 Sponsor:
 CheBanca! La prima banca che ti dà gli interessi in anticipo.
* Fino al 4,70% sul Conto Deposito, zero spese e interessi subito. Aprilo!
 Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=7918&d=10-12



More information about the whatwg mailing list