[
Lists Home |
Date Index |
Thread Index
]
From: "Joe English" <jenglish@flightlab.com>
> Tim Bray wrote:
> > Rick Jones wrote:
> >
> > > Why do the the values of an ID attribute have to start with something
> > > besides a number?
> >
> > Inherited from SGML. No other real good reason for it. -Tim
>
> ... and SGML did it that way because an ID-valued attribute
> is a name for the element on which it appears, so it has
> the same lexical form as other names.
And names are different from numbers because then they can be used
as name tokens in programming languages and scripts.
For example, I think it was Netscape 4's object model, an HTML element
was available as an object named by its ID/name. An element ID that
started with a number would be treated as a number by the JavaScript
(causing an error.) Whether this is so useful is debatable...
Cheers
Rick Jelliffe
|