Next in thread → Next in month →

Re: [xml-dev] another naieve question - valid characters for ID values

From
Rick Jelliffe <>
To
Date
2002-08-08T05:12:50Z
ID
<021701c23e9a$3de3f330$>
Thread
Re: [xml-dev] another naieve question - valid characters for ID values
From: "Joe English" <>
 
> 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
Next in thread → Next in month →