10-19-2008, 08:15 AM
2. a bunch of inner divs, which are moved around by mouse click
3 whenewer i do outerdiv.getElementsByTagName('div'), they come out in same order
seems to me this works in order as they were originaly added ?
10-19-2008, 09:31 AM
getElementsByTagName returns a live NodeList. NodeLists sort in ascending depth-first traversal order on the node tree of the document. They should come out in the order they are placed in the DOM at the time of traversal.
Are you actually changing their position in the DOM or are you merely changing their positioning in the layout?
10-19-2008, 10:45 AM
var tags = mDiv.getElementsByTagName('div');
tags[i].style.left = '30px'
10-19-2008, 12:44 PM
Yep, that's a change of it's position in the layout, not it's position in the document tree. A change in the position in the document tree is equivalent to moving it in the source code relative to the other divs.
NodeLists operate on the document tree, not the presentation.