[thelist] What's the reasoning behind not starting IDs with a number?
Matt Warden
mwarden at gmail.com
Thu Jan 11 08:49:37 CST 2007
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.
More information about the thelist
mailing list