Rather than hacking core consider doing something like...

element.descendants().invoke('stopObserving');
element.stopObserving();

..before removing your element from the DOM.

You could also encapsulate this in a function wrapping Element#remove,
which IMHO is something Prototype should do out of the box.

For the future this kind of request is probably best posted in the
general group.

Mike.



On Sep 30, 2:26 pm, kef <f.watt...@gmail.com> wrote:
> Hello,
>
> I am currently working on an AJAX application (prototype 1.6.1). As
> usual, it runs very well on Chrome and Firefox but we encounter
> difficulties, particularly with Internet Explorer 6.
>
> After much research, it appears that the problem is related to the
> "memory leak". In fact, i reload only some parts of page. (I keep
> always the header and footer) so a large part of the memory used is
> never released.
>
> I found a solution partially responsive to my needs but it involves
> changing the core prototype. Prior to Ajax call, I clean all events on
> elements will be replaced (like _destroyCache during the unload of
> window).
>
> There may be a cleaner solution but I have not found.
>
> My changes here:
>    remove: function (element) (
>      / / Begin Fix
>      if (element = $ (element))
>          element.stopObserving (false, true);
>      / / End Fix
>      element.parentNode.removeChild (element);
>      return element;
>    )
>
>    stopObserving function (element, eventName, handler) (
>      element = $ (element);
>
>      / / Begin Fix
>      if (handler === true) (
>          for (var i = 0, length = CACHE.length; i <length; i + +)
>              if (CACHE [i]. descendantOf
>                   CACHE & & [i]. DescendantOf (element)) (
>                  Event.stopObserving (CACHE [i], eventName);
>                  CACHE [i] = undefined;
>              )
>          CACHE = CACHE.reject (Object.isUndefined);
>      )
>      / / End Fix
>      ....
> )
>
> In view of the evolution of AJAX and implementation of Internet
> Explorer browsers, I think it may be advisable to incorporate a
> equivalent system in core of prototype.
>
> Regards, Franck
--~--~---------~--~----~------------~-------~--~----~
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