Last week the WebKit team announced support for DOM Level 3 XPath in the nightly builds.
If you want to play with that, there’s a tutorial on Mozilla’s XPath support, which has live examples that work with WebKit.
Native XPath in the browser means we can ditch the expensive calls to document.getElementsByClassName() in our libraries.

2 Comments
I don’t understand. Why would byClassName be more expensive to implement than xpath ? Or is it because you can’t point to exactly what you want and need expensive enumerations ?
Whatever getElementById will always be the fastest choice, and it’s better to reorganise the page in order to use it.
@ jmdesp: no doubt that a native version of getElementBySelector would be fast. It’s one of the items the WHAT-WG considering.
But given the choice between Prototype’s getElementsByClassName(), and a native XPath expression, I’ll take the later.