wood burning stoves 2.0*
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "JQuery vs Dojo" Watch "JQuery vs Dojo" New topic
Author

JQuery vs Dojo

Jon Fisher
Greenhorn

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:
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" );
});
});


jQuery:
jQuery("tr:nth-child(odd)").addClass("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="http://www.omnytex.com" target="_blank" rel="nofollow">http://www.omnytex.com</a><br />AIM/Yahoo: fzammetti<br />MSN: fzammetti@hotmail.com<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="http://javawebparts.sourceforge.net" target="_blank" rel="nofollow">http://javawebparts.sourceforge.net</a><br /> Supplying the wheel, so you don't have to reinvent it!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JQuery vs Dojo
 
Similar Threads
JSTL vs DOM generated HTML Table
Presentation View
Dojo vs Prototype
jQuery vs Dojo
JQuery vs Ajax Frameworks