@@ -9583,13 +9583,13 @@ define('select2/utils',[], function () {
95839583 function DecoratedClass ( ) {
95849584 var unshift = Array . prototype . unshift ;
95859585
9586- unshift . call ( arguments , SuperClass . prototype . constructor ) ;
9587-
95889586 var argCount = DecoratorClass . prototype . constructor . length ;
95899587
95909588 var calledConstructor = SuperClass . prototype . constructor ;
95919589
95929590 if ( argCount > 0 ) {
9591+ unshift . call ( arguments , SuperClass . prototype . constructor ) ;
9592+
95939593 calledConstructor = DecoratorClass . prototype . constructor ;
95949594 }
95959595
@@ -9611,23 +9611,26 @@ define('select2/utils',[], function () {
96119611 for ( var m = 0 ; m < decoratedMethods . length ; m ++ ) {
96129612 var methodName = decoratedMethods [ m ] ;
96139613
9614- var originalMethod = function ( ) { } ;
9614+ function calledMethod ( methodName ) {
9615+ // Stub out the original method if it's not decorating an actual method
9616+ var originalMethod = function ( ) { } ;
96159617
9616- if ( methodName in DecoratedClass . prototype ) {
9617- originalMethod = DecoratedClass . prototype [ methodName ] ;
9618- }
9618+ if ( methodName in DecoratedClass . prototype ) {
9619+ originalMethod = DecoratedClass . prototype [ methodName ] ;
9620+ }
96199621
9620- var decoratedMethod = DecoratorClass . prototype [ methodName ] ;
9622+ var decoratedMethod = DecoratorClass . prototype [ methodName ] ;
96219623
9622- function calledMethod ( ) {
9623- var unshift = Array . prototype . unshift ;
9624+ return function ( ) {
9625+ var unshift = Array . prototype . unshift ;
96249626
9625- unshift . call ( arguments , originalMethod ) ;
9627+ unshift . call ( arguments , originalMethod ) ;
96269628
9627- return decoratedMethod . apply ( this , arguments ) ;
9629+ return decoratedMethod . apply ( this , arguments ) ;
9630+ }
96289631 }
96299632
9630- DecoratedClass . prototype [ methodName ] = calledMethod ;
9633+ DecoratedClass . prototype [ methodName ] = calledMethod ( methodName ) ;
96319634 }
96329635
96339636 return DecoratedClass ;
@@ -9812,8 +9815,6 @@ define('select2/results',[
98129815
98139816 var $options = self . $results . find ( ".option" ) ;
98149817
9815- console . log ( $options ) ;
9816-
98179818 $options . each ( function ( ) {
98189819 var $option = $ ( this ) ;
98199820 var item = $option . data ( "data" ) ;
@@ -9967,7 +9968,7 @@ define('select2/options',[
99679968 this . dataAdapter = SelectData ;
99689969 this . resultsAdapter = ResultsList ;
99699970 this . dropdownAdapter = Dropdown ;
9970- this . selectionAdapter = Selection ;
9971+ this . selectionAdapter = options . selectionAdapter || Selection ;
99719972 }
99729973
99739974 return Options ;
0 commit comments