> > 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. --~--~---------~--~----~------------~-------~--~----~ 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 prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---