@ -75,25 +75,25 @@ $.fn.dropdown = function(parameters) {
module . debug ( 'Initializing dropdown' , settings ) ;
module . debug ( 'Initializing dropdown' , settings ) ;
if ( module . is . alreadySetup ( ) ) {
if ( module . is . alreadySetup ( ) ) {
module . error ( error . alreadySetup ) ;
module . setup . reference ( ) ;
}
}
else {
else {
module . setup . layout ( ) ;
module . setup . layout ( ) ;
}
module . save . defaults ( ) ;
module . set . selected ( ) ;
module . save . defaults ( ) ;
module . set . selected ( ) ;
module . create . id ( ) ;
module . create . id ( ) ;
if ( hasTouch ) {
module . bind . touchEvents ( ) ;
}
module . bind . mouseEvents ( ) ;
module . bind . keyboardEvents ( ) ;
if ( hasTouch ) {
module . bind . touchEvents ( ) ;
}
module . bind . mouseEvents ( ) ;
module . bind . keyboardEvents ( ) ;
module . observeChanges ( ) ;
module . instantiate ( ) ;
module . observeChanges ( ) ;
module . instantiate ( ) ;
}
} ,
} ,
instantiate : function ( ) {
instantiate : function ( ) {
@ -161,7 +161,6 @@ $.fn.dropdown = function(parameters) {
} ,
} ,
setup : {
setup : {
layout : function ( ) {
layout : function ( ) {
if ( $module . is ( 'select' ) ) {
if ( $module . is ( 'select' ) ) {
module . setup . select ( ) ;
module . setup . select ( ) ;
@ -212,6 +211,21 @@ $.fn.dropdown = function(parameters) {
;
;
}
}
module . refresh ( ) ;
module . refresh ( ) ;
} ,
reference : function ( ) {
var
index = $allModules . index ( $module ) ,
$firstModules ,
$lastModules
;
module . debug ( 'Dropdown behavior was called on select, replacing with closest dropdown' ) ;
// replace module reference
$module = $module . parent ( selector . dropdown ) ;
module . refresh ( ) ;
// adjust all modules
$firstModules = $allModules . slice ( 0 , index ) ;
$lastModules = $allModules . slice ( index + 1 ) ;
$allModules = $firstModules . add ( $module ) . add ( $lastModules ) ;
}
}
} ,
} ,
@ -1647,10 +1661,9 @@ $.fn.dropdown = function(parameters) {
}
}
} )
} )
;
;
return ( returnedValue !== undefined )
return ( returnedValue !== undefined )
? returnedValue
? returnedValue
: thi s
: $allModule s
;
;
} ;
} ;