Anyway, I ended up excavating Firebug's highlight-a-node code to turn it into a tiny lib and then use that lib for beefing up Jesse Ruderman's jsenv bookmarklet with a live edit XPath field highlighting all matches in the page as you type:
It tells you what the expression matches in the title bar of the jsenv window, and signals some additional colour coded info via the XPath input field's border:
- red for illegal expressions,
- green for matching nodes,
- gray for 0 matched nodes,
- yellow for a string,
- blue for a number and
- magenta for a boolean value.
The ideal spot for this feature would probably be as an extra feature to toggle on and off in Firebug's HTML view -- to filter the view by, for instance. The more I think of it, the more useful this feature would be in that shape. I hope the Firebug Working Group is as open to additional community developers as it seems to aim for.
Anyway, here is the XPath jsenv; enjoy!