VOTE: A potentially major change to QueryPath.

Sep 1 2012

TL;DR: There's an experimental version of QueryPath 3 for you to try and let me know what you think:

Either respond at or to @querypath on Twitter.

Read on for the onger explanation. <!--break--> Over the course of QueryPath's life, several people have requested that I change one major thing about QueryPath:

  • In QueryPath 2, find() and related functions return THE SAME object, instead of following jQuery and returning A NEW object.

Based on some recent discussions, I decided to try changing this behavior for QueryPath 3.

  • In the experimental version, each query method (find(), next(), top(), etc.) returns a NEW object.
  • Or, to put it another way, find() now works like branch() used to work. All other methods work like that, too.
  • branch() is still there for backward compatibility
  • findInPlace() has been added. It acts like the old find().

Please try the experimental version and give me some feedback. Is this better or worse than the old QueryPath?

Let me know by September 8.


  • This new version is about the same speed as QueryPath 3.x alpha 2.
  • This new version will take up a little more memory, but not noticeably more in most cases.


You can find this code in the branch named feature/find-v2 in GitHub. It's a branch off of 3.x. If people like this behavior, I will merge it into 3.x and it will be part of QueryPath 3.