jquery/jquery-mobile — pull request #3652 by gabrielschulhof (2012-02-27 21:50:44+00:00)
Title: Popup stack management

When opening one popup from another popup, correctly set the history, and make it possible to close popups by clicking "Back". This is done in one of two ways:

1. When the first popup is shown, ```#&ui-state=dialog``` is appended to the location, and all subsequent popups do not modify the location further. When the user clicks "Back", all popups disappear. Otherwise, if the last popup is closed, ```window.history.back()``` is called to restore the pre-hash-change URL.

2. When the first popup is shown, ```#jqmNPopups=1``` is appended to the location, and all subsequent popups modify this location by replacing the hash with ```#jqmNPopups=n```, where n is the number of popups currently in the stack. When the user clicks "Back", the last popup in the stack is removed. Similarly, when the user closes a popup, ```window.history.back()``` is called.

Both of these methods are implemented, and both support the closing of popups out of stack order. One can be chosen by setting ```$.mobile.popupsHaveOneHistoryEntry``` to either true or false.