I've been trying to create a chain of indexes from the given element up to the body element:
result = $(given_element).parents().map(function(){ return $(this).index();}).get().reverse().join(",") + result;
another code (explored before the above):
var result = "";
given_element.parents().each(function() { result = $(this).index() + "," + result;});
The example of the result: "12,2,0,0,1,0,0,1,0"
and the result of my php script (based on PHP Simple html parser) which performs the same task is: "0,2,0,0,1,0,0,1,0,0" (This is the correct result )
The jquery produced wrong result always has wrong huge numbers at the beginning of the chain (12 here, may be 72, 16, 22... etc... in other cases but it's constant for every given page with the given element)
All other chains produced (e.g. tagName, element.prop...) are OK in both scripts.
Whats wrong with the "index()" of body element children? Or with me? ;)