When I do:
Event.observe(window, 'resize', alert); //Note: alert is the common
javascript alert function, but it will be called with no params.
Then I can do the following:
Event.stopObserving(window, 'resize', alert);
and:
Event.stopObserving(window, 'resize');
However I cannot do:
Event.stopObserving(window); //Firebug says "TypeError:
element.stopObserving is not a function"
This seems contradictory to the documentation here (
http://www.prototypejs.org/api/event/stopObserving ) which list the
three forms. It seems to me that it would make sense to extend window
like document is so that you could call observe and stopObserving on
it.
I would like to know, is there some reason that it behaves this way or
if its a bug. If it is I would happily write a patch for this. The
obvious concern would be browser interoperability, so if there are
reasons that window cannot be extended, I would also like to know what
those are.
Thanks!
Allen