IDs [was: Re: [whatwg] Re: WEB_FORMS 2.0 comment, repetition model, using reserved macro scripting syntax]

Ian Hickson ian at hixie.ch
Wed Nov 10 13:45:01 PST 2004


On Sat, 28 Aug 2004, Anne van Kesteren wrote:
> > > >
> > > > Doesn't help in XML, but in XML DTDs aren't needed at all anyway, 
> > > > so the point is largely moot.
> > > 
> > > Maybe xml-editor at w3.org could be mailed to address this issue? If 
> > > they accept it as a valid issue 'xs:ID' will eventually change, 
> > > right?
> > 
> > What exactly would the issue be? "Not enough characters are valid in 
> > IDs"? I suppose someone could raise that, but I doubt that changing 
> > XML syntax (this would require revving XML) will be very popular.
> 
> It probably has to be changed, otherwise it might be rejected be the 
> browser. Example[1]:
> 
>   <html id="[test]">
>    <style>html{background:red}#[test]{background:lime}</style>
> 
> Now I see this I'm not even sure if it is backwards compatible enough.

It's not a valid ID, sure, but that's ok -- it's not meant to be addressed 
directly, it's in a template. Once the template is generated, it'll have a 
valid ID value that you can use.

Note that the above example is invalid CSS -- you need to escape the [] 
characters, so it is:

   #\[test\] { ... }

Also note that in at least one browser, getElementByID('[test]') returns 
the right element in the example above (although for some reason #\[test\] 
doesn't, I haven't tried to find out why).

I don't really see the problem.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'



More information about the whatwg mailing list