"Let's say, for example, that you wanted to find all the links on a page. You might consider using document.getElementsByTagName('a'), but then you'll still need to check each element to see if it has an href attribute, because the <a> element can also be used for named anchors. Instead, use Firefox's built-in XPath support to find all the <a> elements that have an href attribute."
- Mike Chelen
from Bookmarklet