[thelist] What's the reasoning behind not starting IDs with anumber?

Tab Alleman talleman at Lumpsum.com
Thu Jan 11 09:09:46 CST 2007


Don't id's become part of the DOM?   

Would 0.focus() mean focus on the object whose ID="0", or focus on the first object on the page?

> -----Original Message-----
> From: thelist-bounces at lists.evolt.org
> [mailto:thelist-bounces at lists.evolt.org]On Behalf Of Matt Warden
> Sent: Thursday, January 11, 2007 9:50 AM
> To: thelist at lists.evolt.org
> Subject: Re: [thelist] What's the reasoning behind not 
> starting IDs with
> anumber?
> 
> 
> On 1/11/07, liorean <liorean at gmail.com> wrote:
> > The same reason 1e2 is the number 100 and not the identifier '1e2'.
> > The same reason 1.2 is the number 1.2 and not the property 
> '2' of the
> > object '1'. The same reason 0xd is the number 13 and not the
> > identifier '0xD'... and I could go on... Because numbers are
> > fundamental data types in virtually all programming or data 
> languages,
> ....
> > Also there's quite some legacy. CSS, JavaScript, all
> > server side languages I can think of, and most other languages that
> > might handle HTML and XML identifiers have clear breaks between
> > numbers and identifiers or strings in their own parsers.
> 
> A very good argument.
> 
> Would this be an issue in any instance other than the automatic
> creation of variables based on the ID? If you always interacted with
> the document like:
> 
> var foo = document.getElementById("0xD");
> 
> I don't think it would ever matter. And from the document perspective,
> there isn't any difference between:
> 
> <foo value="0xD">
> 
> and
> 
> <foo id="0xD">
> 
> It seems to me it only really becomes a problem if 0xD would
> automatically become a variable in the programming language (not
> unheard of). Is there something I'm not thinking about?
> 
> -- 
> Matt Warden
> Cleveland, OH, USA
> http://mattwarden.com
> 
> 
> This email proudly and graciously contributes to entropy.
> -- 
> 
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
> 
> For unsubscribe and other options, including the Tip Harvester 
> and archives of thelist go to: http://lists.evolt.org 
> Workers of the Web, evolt ! 
> 



More information about the thelist mailing list