You need to find the stored responders
of your window
object, which are assigned by prototype.js in the following way (see prototype.js 1.7, event.js line 774):
function observeStandardEvent(element, eventName, responder) {
var actualEventName = getDOMEventName(eventName);
if (element.addEventListener) {
element.addEventListener(actualEventName, responder, false);
} else {
element.attachEvent('on' + actualEventName, responder);
}
}
So prototype.js isn't storing your responders
on a variable somewhere , but just assigning them on to your element
- in this case the window
.
Sadly prototype.js has no such thing as jQuerys click
(as suggested by isick). But there are plenty of other solutions available, you should have a look at the related question "Trigger an event with Prototype".
especially on Gregs answer.
Using his Element.triggerEvent(window, 'load')
should do the job.
Another (propably even cleaner) solution would be to use Prototypes Event.fire
Neither Gregs answer nor the obvious Event.fire
will do the job on window
!
But there is a custom built solution from balupton on his question Binding and triggering native and custom events in Prototype he published a gist which seems to be working pretty well!
I made a (dirty) jsfiddle which is proving the possibility of it. Its kind of an inception though.