DOM 3 XPath in Web Kit

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.

More like this: .

2 Comments

  1. jmdesp
    Posted October 29, 2006 at 8:02 am | Permalink

    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.

  2. Posted October 29, 2006 at 10:18 am | Permalink

    @ 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.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*