[annotator-dev] About the future of the Range implementation

Riccardo Tasso riccardo.tasso at gmail.com
Wed Jun 18 15:32:04 UTC 2014

Off Topic: how can I use built-in parsers to get the xpath of a given dom
element and vice-versa?

(I had to implement my own parser as I didn't know which were the


2014-06-18 17:10 GMT+02:00 Randall Leeds <tilgovi at hypothes.is>:

> On Jun 17, 2014 11:21 PM, "Riccardo Tasso" <riccardo.tasso at gmail.com>
> wrote:
> >
> > Just a question: why did you choose xpath instead of css selector which
> are parsed by jquery?
> >
> > Is there a javascript library which parses xpath? If I remember well you
> implemented an xpath finder in annotator, but probably it would be usefull
> to have it as a separate component too.
> >
> Both XPath and CSS are standards, understood by browsers. You don't need
> jQuery to use CSS selectors.
> We have a simple parser which works on some malformed HTML when the built
> in parser fails.
> As to why XPath instead of CSS? I believe the nth-of-type selectors and
> such are only since CSS3. The types of queries we use XPath for have been
> supported much longer.
> These days you might be able to accomplish the same with CSS but this is
> case is exactly what XPath was designed for.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/annotator-dev/attachments/20140618/327c6396/attachment-0004.html>

More information about the annotator-dev mailing list