#1329 new

Exception in stopObservingElement in IE8

Reported by Victor | March 16th, 2012 @ 05:18 PM

stopObservingElement raises exception 'responder is null or not an object' in IE8:

  function stopObservingElement(element) {
    var registry = getRegistryForElement(element); // creates empty registry {element: element}

    var entries, i;
    for (var eventName in registry) { // property `element` is enumerated
      entries = registry[eventName];  // entries = registry['element'] == e.g. HTMLCommentElement
      i = entries.length;             // element has non-zero length
      while (i--)
        removeEvent(element, eventName, entries[i].responder); // error: entries[i] is undefined!
  1. I am invoking Element#update(), it collects child elements (and comments in IE!) and calls purgeElement() for each element.

  2. Then purgeElement() calls stopObservingElement() for comment element.

  3. Prototype unnecessarily creates new registry (here may be performance improvement for all browsers) with {element: element}, property element of registry is successfully enumerated in for ... in loop, and comment element has non-zero length property, but indexed access returns undefined.


  1. There is no need to create new empty registry and create for loop when element has no registry.
  2. There should be some additional checks for element in for loop.

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

The Prototype JavaScript library.

Shared Ticket Bins

People watching this ticket