[Greasemonkey] Grab text string in TD

Julien Couvreur julien.couvreur at gmail.com
Fri Apr 22 15:03:53 EDT 2005

On 4/22/05, Aaron Boodman <zboogs at gmail.com> wrote:
> "with (this) {
>  var x = 3;
>  return x;
> }
> Unless you know Javascript really well, this probably won't do what you think."

For more details, read http://jibbering.com/faq/faq_notes/closures.html
"The with statement evaluates an expression and if that expression is
an object it is added to the scope chain of the current execution
context (in front of the Activation/Variable object)."

The Activation/Variable object is where var x gets stored. If "this"
contains a member called x, any lookup for "x" will return "this.x",
not the "var x". Definitely tricky.

I plan on recording a short presentation or screencast on the topic,
as the object and execution model for Javascript takes a bit of time
to understand. The paper above really helps, but I think that an
animation of how objects connect to each other, are created and so on
would really make things simpler. A picture is worth a thousand words.
I'll let you know when I get it ready, if anyone's interested.


More information about the Greasemonkey mailing list