Bug Tracker

Opened 9 years ago

Closed 8 years ago

Last modified 8 years ago

#10161 closed bug (cantfix)

CSS modifications not reset on unload

Reported by: dam@… Owned by:
Priority: low Milestone: None
Component: event Version: 1.6.2
Keywords: Cc:
Blocked by: Blocking:


Consider http://jsfiddle.net/PDwpP/40/

To observe the issue, the Results iframe should be opened in a separate window. Only tried with Firefox 6.

After pressing the button, the 'Progress...' div is colored in red and the page is navigated away (in this example, to a non-existing URL). Pressing 'Back' returns to the original page and the div is still red (bad behaviour).

Try changing the version (in the HTML part) to 1.3.2, update and repeat the above steps. After pressing 'Back' the div is black (wanted behaviour).

The problem is present in any version after 1.3.2. After bisecting, it appears that the commit that introduces the problem is f3474c00cd6d9e5fd61b6ef1562003e9986ad67d

Change History (6)

comment:1 Changed 9 years ago by timmywil

Component: unfiledevent
Priority: undecidedlow
Status: newopen

comment:2 Changed 9 years ago by timmywil


comment:3 Changed 9 years ago by dmethvin

It's not likely to be a jQuery bug, since it happens without jQuery being included:


comment:4 in reply to:  3 Changed 8 years ago by dam@…

Replying to dmethvin:

It's not likely to be a jQuery bug, since it happens without jQuery being included: http://jsfiddle.net/dmethvin/PDwpP/42/

Confirmed with Firefox 6.

Still, jQuery 1.3.2 seems to have worked around this. The workaround seems like a side effect of something else, but maybe still a good idea?

The use case I am fighting with is a page overlay that is shown upon form submit, covering the whole window as an indication that the request is being processed. Still showing that when pressing 'Back' is a major pain.

comment:5 Changed 8 years ago by dmethvin

Resolution: cantfix
Status: openclosed

Given your bisect result I am pretty sure this is a result of the Firefox bfcache feature. In 1.3.2 we attached to the unload event in all browsers which defeated the bfcache; that was fixed in 1.4 and we only attached to unload in IE to handle some memory leak issues.

So yes, jQuery used to defeat the bfcache which fixed this particular issue but destroyed performance for the other 95% of the time. So it isn't something we'd reinstate.

Google around for ways to defeat bfcache, for example you could bind to the pageshow event to undo the red text.

comment:6 Changed 8 years ago by dam@…

Thank you very much.

Indeed, binding to pageshow (instead of unload) works without breaking caching, which makes Back button work instantly and also without losing any other dynamic changes in the page (as long as the cache is hot, but there is the ready event for when the cache has expired anyway).

Thanks again!

Note: See TracTickets for help on using tickets.