@@ -104,6 +104,22 @@ $.widget( "mobile.selectmenu", $.mobile.selectmenu, {
104
104
}
105
105
} ,
106
106
107
+ _handleMenuPageHide : function ( ) {
108
+ // TODO centralize page removal binding / handling in the page plugin.
109
+ // Suggestion from @jblas to do refcounting
110
+ //
111
+ // TODO extremely confusing dependency on the open method where the pagehide.remove
112
+ // bindings are stripped to prevent the parent page from disappearing. The way
113
+ // we're keeping pages in the DOM right now sucks
114
+ //
115
+ // rebind the page remove that was unbound in the open function
116
+ // to allow for the parent page removal from actions other than the use
117
+ // of a dialog sized custom select
118
+ //
119
+ // doing this here provides for the back button on the custom select dialog
120
+ $ . mobile . _bindPageRemove . call ( this . thisPage ) ;
121
+ } ,
122
+
107
123
build : function ( ) {
108
124
var selectId , prefix , popupId , dialogId , label , thisPage , isMultiple , menuId , themeAttr , overlayThemeAttr ,
109
125
dividerThemeAttr , menuPage , listbox , list , header , headerTitle , menuPageContent , menuPageClose , headerClose , self ,
@@ -229,21 +245,7 @@ $.widget( "mobile.selectmenu", $.mobile.selectmenu, {
229
245
230
246
// button refocus ensures proper height calculation
231
247
// by removing the inline style and ensuring page inclusion
232
- this . menuPage . bind ( "pagehide" , function ( ) {
233
- // TODO centralize page removal binding / handling in the page plugin.
234
- // Suggestion from @jblas to do refcounting
235
- //
236
- // TODO extremely confusing dependency on the open method where the pagehide.remove
237
- // bindings are stripped to prevent the parent page from disappearing. The way
238
- // we're keeping pages in the DOM right now sucks
239
- //
240
- // rebind the page remove that was unbound in the open function
241
- // to allow for the parent page removal from actions other than the use
242
- // of a dialog sized custom select
243
- //
244
- // doing this here provides for the back button on the custom select dialog
245
- $ . mobile . _bindPageRemove . call ( self . thisPage ) ;
246
- } ) ;
248
+ this . _on ( this . menuPage , { pagehide : "_handleMenuPageHide" } ) ;
247
249
248
250
// Events on the popup
249
251
this . listbox . bind ( "popupafterclose" , function ( ) {
0 commit comments