So, (sorry not to capture all this in a single post)...
To re-iterate, Kangax, you _should_ be using .bindAsEventListener in your
first case if you want to guarantee backwards X-browser support.
On Sun, Mar 15, 2009 at 9:52 AM, Ryan Gahl <ryan.g...@gmail.com> wrote:
> On Sun, Mar 15, 2009 at 9:36 AM, Ryan Gahl <ryan.g...@gmail.com> wrote:
>> What this all means is that these 2 expressions are functionally
>>> identical (considering that they are called from within the same
>>> execution context):
>>> myElement.observe('click', onClick.bind(this));
>>> myElement.observe('click', onClick.bindAsEventListener(this));
>> FWIW, this was not always true in prototype, which is likely where the
>> confusion comes from. .bindAsEventListener, once upon a time, _was_ required
>> with .observe() - back before elements returned from $() did not get
>> .observe() attached to them (when "Event.observe(el, evtName, func);" was
>> the only way to use .observe);
>> I agree, of course, that it is hardly ever needed now, but the fact that
>> you identified a case where it _is_ needed (or desirable), kind of points
>> towards keeping it in the API. It's not really doing any harm.
> Actually, now that I think about this more, the real reason it was (and
> still is) needed, was that in IE6, that event object had to be pulled from
> window.event and then passed into the bound function, otherwise it was
> (still is for IE6 support) on the developer to do that part (if (!evt) evt =
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to firstname.lastname@example.org
To unsubscribe from this group, send email to
For more options, visit this group at