From 0c676269e9810495ab3c668c469e68a3d0bbb4be Mon Sep 17 00:00:00 2001 From: Andrew Dupont Date: Fri, 28 Mar 2008 12:48:42 -0500 Subject: [PATCH] Fix issue where Safari 3 deletes custom properties from the document object when the page is returned to via the back button. --- src/event.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/event.js b/src/event.js index a271abe..5ccc055 100644 --- a/src/event.js +++ b/src/event.js @@ -188,10 +188,20 @@ Object.extend(Event, (function() { cache[id][eventName] = null; } + + // Internet Explorer needs to remove event handlers on page unload + // in order to avoid memory leaks. if (window.attachEvent) { window.attachEvent("onunload", destroyCache); } + // Safari has a dummy event handler on page unload so that it won't + // use its bfcache. Safari <= 3.1 has an issue with restoring the "document" + // object when page is returned to via the back button using its bfcache. + if (Prototype.Browser.WebKit) { + window.addEventListener('unload', Prototype.emptyFunction, false); + } + return { observe: function(element, eventName, handler) { element = $(element);