This problem is in prototype 1.6.0. It seems the portion that fails
has been fixed in the newest on github.

Old snippet:
} else if (!eventName) {
        Object.keys(getCacheForID(id)).each(function(eventName) {
          element.stopObserving(eventName); //This caused the problem
        });
        return element;
      }

New snippet:
} else if (!eventName) {
      // If both the event name and the handler are omitted, we stop
observing
      // _all_ handlers on the element.
      registry.each( function(pair) {
        var eventName = pair.key, responders = pair.value;

        responders.each( function(r) {
          Element.stopObserving(element, eventName, r.handler); //This
should fix it
        });
      });
      return element;
    }

However, I'm still curious why you don't extend window with observe()
and stopObserving()?

On Aug 12, 12:49 pm, kangax <kan...@gmail.com> wrote:
> On Aug 11, 4:20 pm, Allen <bla...@gmail.com> wrote:
>
>
>
>
>
> > 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
>
> I can't reproduce this in FF 3.5.2 using latest version of Prototype.
>
> --
> kangax
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to 
prototype-core-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to