ok, I just code reviewed a fix in scrollrichedittext that I don't really
understand. Perhaps one of the Javascript gurus on the list can
enlighten us.
The following code generated a waring that inp was undefined:
this.applyConstraint("stepsize",
function() { this.setAttribute("stepsize",
parent.inp.lineheight); },
[p.inp, "lineheight"]);
The bug was fixed by adding an explicit 'this' before parent.inp:
this.applyConstraint("stepsize",
function() { this.setAttribute("stepsize",
this.parent.inp.lineheight); },
[p.inp, "lineheight"]);
My first thought was... I thought you never needed an explicit this for
parent since it is defined at construct time.
My second thought was... um, what the heck is 'this' in the middle of an
anonymous function? I would have thought it was no longer in the scope
of the object. Why does this work?
Confused,
Sarah
_______________________________________________
Laszlo-user mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-user