[dojo-contributors] dijit: removing id attributes in favor of widgetid

Bill Keese bill at dojotoolkit.org
Fri Aug 31 22:15:18 EDT 2007

Tom Trenka wrote:
> Hi guys,
> So in doing a lot of porting work from 0.4 to 0.9 with Dijit, we've run 
> across a number of problems (many of them not Dijit-related), but 
> there's one that stands out that seems like a deliberate choice. 
>  Basically, it seems that Dijit will take something like this:
> <div dojoType="dijit.Menu" id="myMenu"></div>
> ...and in the process of rendering, will change it to this:
> <table dojoType="dijit.Menu" widgetid="myMenu"></table>

id is supposed to get copied for every widgets, usually to the domNode, 
and Adam has a pending checkin to fix the remaining widgets.  The 
exceptional cases are things like spinner, with a template like:

<span> <input> <button/> <button/> </span>

Should the id get copied to the <span> or the <input>?  There are 
arguments for each, but we have to pick one, so we picked the <input> (I 
think it was so <label for=myId> works correctly, required for a11y.) 
But we also apply an id to the <span> based on the id on the srcNode...

In this case you end up with:

<input dojoType=dijit.form.Spinner id=foo>

getting converted to something like:

<span id="foo_widget"> <input id="foo"> ...

(well actually it's a table but you get the idea)

So, I think that should solve all the issues.

More information about the dojo-contributors mailing list