[cosmo-dev] DOM ids for wayward elements

Travis Vachon travis at osafoundation.org
Thu Dec 13 13:56:22 PST 2007


Hi Matthew

This all sounds reasonable, comments below:

> Come up with semantically meaningful ids for every element of the UI  
> that I create (down to each and every button of every dialog box),  
> with enough specificity to ensure a very low probability of  
> collision with any other element in the UI.

I'm surprised that it would be non-trivial to come up for a  
semantically useful name for a UI element. It seems to me that the  
work required to implement the functionality attached to a piece of UI  
would make this kind of a name obvious. If you're picking descriptive,  
semantically useful names the specificity should approach a non issue.  
If two pieces of UI are sufficiently similar that they have similar  
names, that seems like an opportunity to consider simplifying the UI.

>
> Having actually used both approaches on large, complicated, Ajaxy  
> Web apps, I can definitively say that the first approach requires  
> significantly less effort for me personally.

The trouble is that the work required to support robust testing simply  
hasn't been done. When it is done in the current system, it takes a  
significant amount of process: QA files a bug, you add a shortcut to  
the jsid file, you document that shortcut, you mark the bug fixed, QA  
(sometimes!) realizes the bug fix allows them to write the test they  
needed. If was being consistently done I'm not convinced it would be  
less work for you. Talking with QA I've heard anecdotal evidence that  
part of our current lack of testing is directly due to the  
inefficiency in the current process.

Also, in the conversations we've had you did not mention a time when  
you used the process we've proposed in a large web app (that is,  
choose semantically descriptive ids, do not maintain a list of them,  
deal with collisions on a case by case basis). If you have, please  
correct me, but this was not my understanding.

>
> That's all really beside the point, given the obvious advantages  
> (robustness, transparency) of the unique-ids approach for testability.

This is the key point, though it's important to remember that this  
isn't just for testing. There are literally an infinite number of ways  
to extend the web. Extensions like Greasemonkey for Firefox are an  
great example of how working _with_ the web (in this case by providing  
semantically relevant ids for each element) can help other folks make  
your site much more useful.

>
> Y'all figure out what you want to do with this, and let me know what  
> the process is.

I think I've been pretty explicit about what I'm proposing, please let  
me know if there is still confusion.


-Travis


More information about the cosmo-dev mailing list