File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes JQuery vs Dojo Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "JQuery vs Dojo" Watch "JQuery vs Dojo" New topic

JQuery vs Dojo

Jon Fisher

Joined: Sep 30, 2008
Posts: 3
I'm evaluating Dojo vs Jquery. Here is a practical example where Dojo is losing in terms of simplicity. Can someone tell me if there's a better way to do this with dojo?

** Code cleanliness- how would one go about striping a HTML table

dojo.lang.forEach(document.getElementsByTagName("table"), function(table){
dojo.lang.forEach(table.getElementsByTagName("tr"), function(row,i){
if ( i % 2 == 1 )
dojo.html.addClass( row, "odd" );

Frank Zammetti
Ranch Hand

Joined: Dec 16, 2004
Posts: 136
Dojo too has class selector support, although I haven't played with it much... I can't give you the exact code off the top of my head, but you should be able to get pretty close in Dojo to what you write in jQuery.

-- <br />Frank W. Zammetti<br />Founder and Chief Software Architect<br />Omnytex Technologies<br /><a href="" target="_blank" rel="nofollow"></a><br />AIM/Yahoo: fzammetti<br />MSN:<br />Author of "Practical Ajax Projects With Java Technology"<br /> (2006, Apress, ISBN 1-59059-695-1)<br />and "JavaScript, DOM Scripting and Ajax Projects"<br /> (2007, Apress, ISBN 1-59059-816-4)<br />Java Web Parts - <a href="" target="_blank" rel="nofollow"></a><br /> Supplying the wheel, so you don't have to reinvent it!
I agree. Here's the link:
subject: JQuery vs Dojo
It's not a secret anymore!