@@ -206,20 +206,21 @@ define( [
206206 } ,
207207 thisPage = this . element . closest ( ".ui-page" ) ,
208208 myId = this . element . attr ( "id" ) ,
209- self = this ;
209+ o = this . options ,
210+ key , value ;
210211
211212 // We need to adjust the history option to be false if there's no AJAX nav.
212213 // We can't do it in the option declarations because those are run before
213214 // it is determined whether there shall be AJAX nav.
214- this . options . history = this . options . history && $ . mobile . ajaxEnabled && $ . mobile . hashListeningEnabled ;
215+ o . history = o . history && $ . mobile . ajaxEnabled && $ . mobile . hashListeningEnabled ;
215216
216217 if ( thisPage . length === 0 ) {
217218 thisPage = $ ( "body" ) ;
218219 }
219220
220221 // define the container for navigation event bindings
221222 // TODO this would be nice at the the mobile widget level
222- this . options . container = this . options . container || $ . mobile . pageContainer ;
223+ o . container = o . container || $ . mobile . pageContainer || thisPage ;
223224
224225 // Apply the proto
225226 thisPage . append ( ui . screen ) ;
@@ -253,12 +254,15 @@ define( [
253254 _orientationchangeInProgress : false
254255 } ) ;
255256
256- $ . each ( this . options , function ( key , value ) {
257- // Cause initial options to be applied by their handler by temporarily setting the option to undefined
258- // - the handler then sets it to the initial value
259- self . options [ key ] = undefined ;
260- self . _setOption ( key , value , true ) ;
261- } ) ;
257+ // This duplicates the code from the various option setters below for
258+ // better performance. It must be kept in sync with those setters.
259+ this . _applyTheme ( this . element , o . theme , "body" ) ;
260+ this . _applyTheme ( this . _ui . screen , o . overlayTheme , "overlay" ) ;
261+ this . _applyTransition ( o . transition ) ;
262+ this . element
263+ . toggleClass ( "ui-overlay-shadow" , o . shadow )
264+ . toggleClass ( "ui-corner-all" , o . corners ) ;
265+ this . _setTolerance ( o . tolerance ) ;
262266
263267 ui . screen . bind ( "vclick" , $ . proxy ( this , "_eatEventAndClose" ) ) ;
264268
@@ -386,28 +390,13 @@ define( [
386390 } ,
387391
388392 _setOption : function ( key , value ) {
389- var exclusions , setter = "_set" + key . charAt ( 0 ) . toUpperCase ( ) + key . slice ( 1 ) ;
393+ var setter = "_set" + key . charAt ( 0 ) . toUpperCase ( ) + key . slice ( 1 ) ;
390394
391395 if ( this [ setter ] !== undefined ) {
392396 this [ setter ] ( value ) ;
393397 }
394398
395- // TODO REMOVE FOR 1.2.1 by moving them out to a default options object
396- exclusions = [
397- "initSelector" ,
398- "closeLinkSelector" ,
399- "closeLinkEvents" ,
400- "navigateEvents" ,
401- "closeEvents" ,
402- "history" ,
403- "container"
404- ] ;
405-
406- $ . mobile . widget . prototype . _setOption . apply ( this , arguments ) ;
407- if ( $ . inArray ( key , exclusions ) === - 1 ) {
408- // Record the option change in the options and in the DOM data-* attributes
409- this . element . attr ( "data-" + ( $ . mobile . ns || "" ) + ( key . replace ( / ( [ A - Z ] ) / , "-$1" ) . toLowerCase ( ) ) , value ) ;
410- }
399+ this . _super ( key , value ) ;
411400 } ,
412401
413402 // Try and center the overlay over the given coordinates
0 commit comments