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!
What's required to make this work? I'm using FF3b5 on XP. The XPath is working, the title bar shows the count, the input field changes color. But nothing is highlighted, and the arrow keys don't seem to work.
ReplyDeleteI don't know yet, but FF3b5 breaks a lot of things, and this might be one of them. I'm afraid I won't debug or fix things until at least Firebug's command line works well in it again.
ReplyDeleteUntil then, I personally stick with beta 4, though the same error seems to apply there, so when I do debug and fix it, I'll update the post (in a visible manner). Might not happen this week, though.