On Mar 24, 11:30 pm, "T.J. Crowder" <[EMAIL PROTECTED]> wrote:
> 1. Event handlers (like onSuccess) are triggered with the default
> "this" object; the default "this" object is the global object, which
> in browser implementations is the window object.

Apologies for the follow-up post, but I realized when reading another
thread in this forum [1] that the above could be a bit misleading if
you're using Prototype's Event.observe method [2] or the DOM standard
addEventListener function [3], because both of those ensure that
"this" is set to the element being observed, not the global object,
during the call to the handler. The old DOM0 way of hooking up events
(using an onclick attribute in your HTML) and Internet Explorer's
attachEvent function [4] both use the global object as "this".  (Hence
Prototype abstracting away the differences for us with Event.observe,
making IE behave as though it supported the standard method.)

Sorry for the confusion!

[2] http://www.prototypejs.org/api/event/observe
[3] http://developer.mozilla.org/en/docs/DOM:element.addEventListener
[4] http://msdn2.microsoft.com/en-us/library/ms536343(VS.85).aspx
T.J. Crowder
tj / crowder software / com
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to rubyonrails-spinoffs@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 

Reply via email to