@@ -47,6 +47,8 @@ define( [ "jquery",
4747 positionTo : "origin" ,
4848 tolerance : null ,
4949 initSelector : ":jqmData(role='popup')" ,
50+ closeLinkSelector : "a:jqmData(rel='back')" ,
51+ closeLinkEvents : "click.popup" ,
5052 navigateEvents : "navigate.popup" ,
5153 closeEvents : "navigate.popup pagebeforechange.popup" ,
5254 history : true
@@ -552,15 +554,15 @@ define( [ "jquery",
552554 } ,
553555
554556 _closePrereqsDone : function ( ) {
555- var self = this ;
557+ var self = this , opts = self . options ;
556558
557559 self . _ui . container . removeAttr ( "tabindex" ) ;
558560
559561 // remove nav bindings if they are still present
560- self . options . container . unbind ( self . options . closeEvents ) ;
562+ opts . container . unbind ( opts . closeEvents ) ;
561563
562564 // unbind click handlers added when history is disabled
563- self . element . undelegate ( "a:jqmData(rel='back')" , "click.popup" ) ;
565+ self . element . undelegate ( opts . closeLinkSelector , opts . closeLinkEvents ) ;
564566
565567 // remove the global mutex for popups
566568 $ . mobile . popup . active = undefined ;
@@ -623,7 +625,7 @@ define( [ "jquery",
623625 // TODO no clear deliniation of what should be here and
624626 // what should be in _open. Seems to be "visual" vs "history" for now
625627 open : function ( options ) {
626- var self = this , url , hashkey , activePage ;
628+ var self = this , opts = this . options , url , hashkey , activePage ;
627629
628630 // make sure open is idempotent
629631 if ( $ . mobile . popup . active ) {
@@ -635,14 +637,14 @@ define( [ "jquery",
635637
636638 // if history alteration is disabled close on navigate events
637639 // and leave the url as is
638- if ( ! self . options . history ) {
640+ if ( ! opts . history ) {
639641 self . _bindContainerClose ( ) ;
640642
641643 // When histoy is disabled we have to grab the data-rel
642644 // back link clicks so we can close the popup instead of
643645 // relying on history to do it for us
644646 self . element
645- . delegate ( "a:jqmData(rel='back')" , "click.popup" , function ( e ) {
647+ . delegate ( opts . closeLinkSelector , opts . closeLinkEvents , function ( e ) {
646648 self . _close ( ) ;
647649
648650 // NOTE prevent the browser and navigation handlers from
@@ -670,7 +672,7 @@ define( [ "jquery",
670672 }
671673
672674 // swallow the the initial navigation event, and bind for the next
673- self . options . container . one ( self . options . navigateEvents , function ( e ) {
675+ opts . container . one ( opts . navigateEvents , function ( e ) {
674676 e . preventDefault ( ) ;
675677 self . _bindContainerClose ( ) ;
676678 } ) ;
0 commit comments