micro-optimization for xpaths

Don't compute the XPath for each node by traversing up every time.
Instead, track it as we traverse.

Showing ~10-15% improvement in Chrome and FF.
Updated generated files after merging tilgovi's optim. branch
- Improved internal error handling
- Worked around some FF selection bugs