Closed jwestbrook closed 9 years ago
ronin-93814 (at lighthouseapp) April 7th, 2010 @ 10:43 AM
From e795810fd997514b8e6ebd77972291308536f882 Mon Sep 17 00:00:00 2001
From: Jochen Berger <fooberger@googlemail.com>
Date: Wed, 7 Apr 2010 10:36:19 +0200
Subject: [PATCH] Only push observed elements to the CACHE if on IE
---
src/dom/event.js | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/dom/event.js b/src/dom/event.js
index 6efac7d..1a18265 100644
--- a/src/dom/event.js
+++ b/src/dom/event.js
@@ -423,8 +423,10 @@
var registry = Element.retrieve(element, 'prototype_event_registry');
if (Object.isUndefined(registry)) {
- // First time we've handled this element. Put it into the cache.
- CACHE.push(element);
+ if (Prototype.Browser.IE) {
+ // First time we've handled this element. Put it into the cache.
+ CACHE.push(element);
+ }
registry = Element.retrieve(element, 'prototype_event_registry', $H());
}
--
1.6.3.3
ronin-93814 (at lighthouseapp) April 13th, 2011 @ 10:54 AM
still an issue with prototype 1.7
We do this differently now.
previous lighthouse ticket #1025 by ronin-93814 (at lighthouseapp)
All observed elements are being pushed to the CACHE array. This array is used only on IE to be able to clean up the event listeners in the _destroyCache method, which is called upon window.onunload. This patch puts an if (Prototype.Browser.IE) around the invocation of CACHE.push(element); to save some memory on other browsers.
This ticket is related to #466 (Suppress memory leaks from Element.remove and Elemen.update).