pilgrim at gmail.com
Tue Apr 12 21:53:06 EDT 2005
On 4/12/05, Julien Couvreur <julien.couvreur at gmail.com> wrote:
> Another pattern: url re-writing.
Right, like changing links to the printer-friendly version, or forcing
GMail to use https.
> General thought on the examples in the thread so far. A number of them
> illustrate how some things can be done in multiple ways.
> For example, iterating over the a certain kind of element can be done
> with getElementsByTagName or an xpath query, or even using some more
> specific DOM APIs in some cases (document.links).
> As I'm getting more comfortable with XPath, I tend to use it for all
> selection, where possible. Is there a reason why you think using
> getElementsByTagName is better?
It looks simpler, and therefore looks easier to debug (assuming you
haven't wrapped XPath into a helper function already). I have no idea
if one way is significantly faster than the other. Other than that,
no, I have no opinion on which one is "better".
More information about the Greasemonkey