> What does OK mean? It means, that I'm getting the expected output. >What's the problem? The problem is that after calling e.parents(), arguments gets cleared out and is afterwards empty, but only when parents( 'li' ) is empty.
>How are you trying to use this function? I have a recursive tree with an unknown depth. When a leaf is clicked I want to navigate to the top of the tree. I know this may not be the best approach, but I'm having a deadline and right now "best performance" is not top issue. However it will be in the future, but then I will have enough time to investigate all possible ways of doing this. So, when a leaf (leafs are wrapped in <span>) is clicked, I select all parents that are <li> and check each one <li> to see if its direct parent is( 'ul.treeview' ). There is one situation (see P.S.): 1) a leaf with depth >= 0 is clicked ==> parents( 'li' ) is not empty, but after calling it arguments points to the same object as parents( 'li' ) P.S. I had an incorrect wrapping of <span> and <a> and that was the reason for parents( 'li' ) to return an empty object. Now it always return the correct <li> parents of the curent element. But the problem remains - other variables inside the same function are changed and all the same: parents( 'li' ) Thank you. Nikola