I'm pretty sure Prototype has a bug in adding methods to an Event.

My code is:

var MoreEventMethods = {
    absoluteOffsets : function (event) {
        var offset = this.pointer();
        var scroll = document.viewport.getScrollOffsets();
        return {
            left : offset.x + scroll.left,
            top : offset.y + scroll.top
    absoluteX : function (event) {
        var scroll = document.viewport.getScrollOffsets();
        return event.pointerX() + scroll.left;
    absoluteY : function (event) {
        var scroll = document.viewport.getScrollOffsets();
        return event.pointerY() + scroll.top;

if (Prototype.Browser.IE) {
    Object.extend(Event, MoreEventMethods);
} else {
    Object.extend(Event.prototype, MoreEventMethods);

This is not in an "onload" window event handler, but I try to put it
there and it does not work too.

I think it is quite a bug because I have to check for
Prototype.Browser.IE variable.
If prototype supports IE and other browsers, in a very beautiful world
I have never to do that check in my code :))

Futhermore would you please plan a method Event.addMethods ?
Or at least give me some hints so I can develop it for the community ?
(but I don't know if in this moment my javascript knowledge is enough)

Thank you very much for all your work
Listening for an answer...

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 
For more options, visit this group at 

Reply via email to