That was the type of thing I was trying to put together in my head, but for some reason it just wouldn't come together.
Recursive solutions always are harder to wrap your head around, they tend require more "faith" than iterative solutions, and that is not something most programmers are usually accustomed too (all relgious meanings aside of course).
As for the DIV problem, how would you suggest fixing that?
Well not having seen your output I am not sure, but I would suspect you could try putting the 'onClick' handler in the tag you are writing, rather than wrapping that tag. Although this may have the same effect when you are dealing with things like TABLE, TR, UL tags, since they too are container tags which sometimes "enclose" their descendents. The other option, and I am not sure if this would be appropriate or not, is to only wrap your leaf nodes with the "onClick" since they are likely to be text nodes and the like (although things like BR and HR will fall into that category too). Hard to really say without either having some test data, or knowing more about what you want the UI to do in the end.
In reply to Re^3: tracking where I am in a tree structure
by stvn
in thread tracking where I am in a tree structure
by agaffney
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |