jquery/jquery-mobile — pull request #6658 by frequent (2013-10-25 09:30:56+00:00)
Title: fix #6650: panel (external) remove panel classes/properties correctly

Fix #6650:

When a panel is outside of a page and is opened while page A is being viewed, the panel-necessary markup is added to page A.

Clicking on a link on a panel to transition to page B will correctly trigger the panel close methods and cleanup, however for external panels, this line:

var page = this._parentPage ? this._parentPage : $( "." + $.mobile.activePageClass );

inside panel widget `_getPage()` will set page to the page with active class, which switches from A to B before the panel cleanup is done. So some properties are still left on page A (e.g. `panel=open`). When going back to this page, the panel cannot be opened anymore (because it's still set to open).

To fix, I added the `_openedPage` property, which is set to the page that was viewed when the panel opened. This page needs to be cleaned up instead of the active page (so actually the active page selector could go altogether).