[Zope3-dev] Re: [Checkins] SVN: z3c.form/trunk/src/z3c/form/ HTML element ids containing dots are not very good, because then the

Gary Poster gary at zope.com
Sun Jun 3 14:18:47 EDT 2007


On Jun 3, 2007, at 12:58 PM, Stephan Richter wrote:

> Log message for revision 76258:
>   HTML element ids containing dots are not very good, because then the
>   "element#id" CSS selector does not work and at least in firefox the
>   attribute selector ("element[attr=value]") does not work for the id
>   either.
>
>   Thus I converted the entire codebase to use dashes in ids  
> instead. I am
>   sorry if this causes some test-fixing issues for some of you, but  
> making
>   this change sooner rather than later is better in the long run.
>
>   I am going to test this some more now.

Hey.  I've only had limited time to look at the new package(s) but  
what I've seen so far looks good.  I hope to give it a whirl soon.

You may want to check about the browser compatibility of having ids  
and names different.  I know I used to have IE problems when I did  
this.  I tried to Google for verification.  I think you'll find some  
here:

http://channel9.msdn.com/wiki/default.aspx/ 
Channel9.InternetExplorerProgrammingBugs

Look for the section titled "META tags improperly "register" them  
selfs as an ID with document.getElementById()", specifically the  
*second* example.  AFAIK, this would be an IE6 thing; I don't have  
much hands-on pain knowledge with IE7.

In fact, HTML 4 does regard name and id to be in the same namespace  
for anchor tags (see http://www.w3.org/TR/html4/struct/links.html,  
12.2.3) and even requires that they be identical (example is in the  
section).  The IE bug, apparently, is to assume that this constraint  
holds for all name attributes, such as form fields.

So, what you did is technically correct.  However, if you want your  
code to be used be folks who care about supporting IE6 and JS, I  
believe you will want your names and ids to be identical.

I've rung this alarm bell before in other contexts, but this is the  
first time I was able to find corroboration.

Gary


More information about the Zope3-dev mailing list