views:

152

answers:

2

I came across some javascript at work today that used jQuery to fetch two elements. It then used elem.nodeIndex to determine the position in the elements parent for each element. Nothing is setting this property anywhere and I do now see a reference to it in the msdn, mdc, or anywhere else.

I stepped through this javascript in FireFox with FireBug and tested the code in chrome and opera. I am sure nothing was trying to set this property. However, I can't find any information on this nodeIndex property anywhere.

Does nodeIndex exist as a DOM property in IE, or did I miss something while debugging my code?

UPDATE: I asked the same question on the jQuery list and they confirmed the property is for internal use only.:

+2  A: 

It looks like it's jQuery that's adding nodeIndex to nodes in some cases.

kangax
I asked on the jQuery list and apparently this is only intended for internal use.http://groups.google.com/group/jquery-en/browse_thread/thread/2382a66a1ce9edf6/168046b517318240#168046b517318240
Justin Dearing
A: 

Well, the easy answer is: If it isn't documentated anywhere like MDC, MSDN or W3, then it isn't a 'real' DOM property.

The idea of using nodeIndex, is also wrong, why would you want to do that?

Saebekassebil
I don't "want to do that." The fact that it worked in IE, yet wasn't documented was what bothered me.
Justin Dearing