File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 12811281 initSelection : function ( ) {
12821282 var selected ;
12831283 if ( this . opts . element . val ( ) === "" ) {
1284- this . updateSelection ( { id : "" , text : "" } ) ;
12851284 this . close ( ) ;
12861285 this . setPlaceholder ( ) ;
12871286 } else {
13221321 // check for a first blank option if attached to a select
13231322 if ( this . select && this . select . find ( "option:first" ) . text ( ) !== "" ) return ;
13241323
1325- if ( typeof ( placeholder ) === "object" ) {
1326- this . updateSelection ( placeholder ) ;
1327- } else {
1328- this . selection . find ( "span" ) . html ( placeholder ) ;
1329- }
1324+ this . selection . find ( "span" ) . html ( placeholder ) ;
1325+
13301326 this . selection . addClass ( "select2-default" ) ;
13311327
13321328 this . selection . find ( "abbr" ) . hide ( ) ;
14311427
14321428 // single
14331429 data : function ( value ) {
1430+ var data ;
1431+
14341432 if ( arguments . length === 0 ) {
1435- return this . selection . data ( "select2-data" ) ;
1433+ data = this . selection . data ( "select2-data" ) ;
1434+ if ( data == undefined ) data = null ;
1435+ return data ;
14361436 } else {
14371437 if ( ! value || value === "" ) {
14381438 this . clear ( ) ;
You can’t perform that action at this time.
0 commit comments