Hi, On Sep 27, 3:21 pm, "John Resig" <[EMAIL PROTECTED]> wrote: > A couple issues I see. > 1) Completely removing the functionality for Opera, Safari, and FF 3 > seems like a bad idea - we like to make sure that everything is > cleaned up after we're done.
The only browser that has these memory leak problems with event handlers is IE (most likely fixed in 8). Originally the code used "if (browser==IE)" , but then the FF2 bug I linked to in the ticket was found and the sniffing was removed (the dreaded "IE+FF==all browsers" comparison). > 2) Is there some alternative event that we should be binding to for > Opera in order to clean up our event bindings? You don't want to do it yourself, Opera will do it when it decides that it uses too much memory and removes old pages from the memory cache, same for Firefox 3 (although FF has pagehide and pageshow events, but the question is why you would want to remove the listeners, when you are going to add them again later on?). For more info on "fast history navigation": http://www.opera.com/support/search/view/827/ > 3) Is there a way to detect that binding in a way that doesn't involve > browser sniffing? The browser sniffing is only there to fix bugs in old browsers (IE<8, FF<3), where newer versions have already fixed the issues. You can't detect the bug using object or feature detection. This sounds like a valid reason to sniff for these two old browsers. > 4) It sounds like this might be a bug in Firefox 2 and Opera - if they > are incapable of maintaining the cache when an unload event is bound. They are capable, but at the expense of reprocessing all scripts. Having "instant back" is much nicer to the end user, it was one of the major improvements in FF1.5. Fixing this bug improves the user experience of any jQuery enabled site. > Presumably this was fixed in Firefox 3? The issue why FF2 (and all other browsers with it) was given the code (in http://dev.jquery.com/ticket/1911 ) was indeed fixed. So to recap the problems: - IE<8 leaks memory with event handlers - jQuery fixes it using the standard onunload fix - FF<3 has a completely unrelated bug - jQuery also fixes this bug with the onunload fix - also browsers that don't need the fix (FF3/Opera/Webkit/...) get "fixed" as a byproduct - (This breaks certain sites in Opera, depending on the user configuration) - It makes sites using jQuery annoyingly slower in FF3/Opera because they must disable bfcache Regards, Jeroen > --John > > > > On Sat, Sep 27, 2008 at 8:11 AM, JeroenH <[EMAIL PROTECTED]> wrote: > > > Hi, > > > Both Opera and Firefox allow "fast history navigation", or "bfcache". > > In that mode, they remember the state of the previous page, including > > event handlers. > > > Because of bugs in IE and FF<3, jQuery currently removes event > > handlers on "unload" (the last few lines of events.js). That means > > that when going backwards to a jQuery site, all interactivity is lost, > > in theory at least and for quite a few Opera users in practice. > > > Both browsers detect when this would be a problem and will completely > > reload a page and rerun all scripts. This is annoying, since going > > backwards is no longer instantaneous. Opera has an option to disable > > this behaviour, and many users have it disabled, resulting in the > > aforementioned loss of interactivity. > > > The code that's responsible for this is only needed for IE<8 and FF<3. > > It would be better to target just these versions and leave other > > browsers alone, making browsing on jQuery enabled sites more pleasant > > for users of FF 3 and workable in Opera 9.5. > > > This is ticket 3015 (http://dev.jquery.com/ticket/3015). > > > (perhttp://my.opera.com/community/forums/findpost.pl?id=2745411) > > (related:http://groups.google.com/group/jquery-dev/browse_thread/thread/67abd5... > > ) > > > Many thanks, > > > Jeroen --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---