Re: Traversing through DOM, identifying td's and manipulating

Chris <[email protected]> Thu, 02 Mar 2006 01:25:07 -0500
Newsgroups gmane.comp.web.dom.wdf
Message-ID <[email protected]>
Seconding Joris's recommendation -

One of the keys to good DOM scripting is to defer to the compiled code 
of the browser whenever possible. Safari, Firefox, etc may have faster 
and faster scripting engines every day, but no JS loop will ever beat 
the compiled, native code of the browser itself for the same task. 
Performance may not matter when considering a tree with 2 or 3 branches, 
but if a client ends up with a dataset of 7000 rows, you'll hope you 
wrote your code efficiently.

In this case the browser can do this traversal for you via CSS, or you 
can loop with JS. The CSS route leverages the browser's compiled code, 
so it's the best choice. The approach has an added benefit of reducing 
the amount of code you'll be writing.


Joris Huizer wrote:

>Maninder, Singh wrote:
>  
>
>>What would be the best way to do this as I want to traverse through the tree, change the bgcolors and image of the one being clicked, but also change the image&bgcolors of all the rest to make sure they are not highlighted.
>>    
>>
>
>I like to post a CSS solution:
>  
>



Unsubscribe
[email protected]

List info
http://www.quirksmode.org/dom/list.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/wdf-dom/

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/