This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
Love the jquery-like ChildNode interface. I wonder if it makes sense to add a node.index() method that returns the node's index. This would be very helpful when dealing with DOM ranges: range.setStart(node.parentNode, node.index())
Alternatively maybe we could tweak the APIs that use indexes as input to also allow nodes as input: range.setStart(node.parentNode, node)
Or range.setStart(node)
This probably won't cut it, since sometimes range.setEnd(node.parentNode, node.index() + 1); // or +2 is needed
It turns out we already have setStartBefore and the likes, which does exactly what Simon suggest. I personally have no use for this method for now. Not sure if should close the bug.
Since a node.index() function is required by many of the DOM's internal algorithms (i.e. https://dom.spec.whatwg.org/#concept-tree-index), all of the DOM implementations already have a privately-defined method like this. If a use is ever found for this function outside of what is already provided by the DOM, then node.index() would be a freebie to expose in the IDL. For now, there is no point in cluttering up the API.