Browse Source

Move all of the event binding into separate methods

This should make it easier to override in subclasses.
Kevin Brown 10 years ago
parent
commit
f8ca597f02

+ 92 - 63
dist/js/select2.amd.full.js

@@ -1666,11 +1666,85 @@ define('select2/core',[
 
     var self = this;
 
-    this.data.bind(this, $container);
-    this.selection.bind(this, $container);
+    // Bind the container to all of the adapters
+    this._bindAdapters();
 
-    this.dropdown.bind(this, $container);
-    this.results.bind(this, $container);
+    // Register any DOM event handler
+    this._registerDomEvents();
+
+    // Register any internal event handlers
+    this._registerSelectionEvents();
+    this._registerResultsEvents();
+    this._registerEvents();
+
+    // Set the initial state
+
+    this.data.current(function (initialData) {
+      self.trigger('selection:update', {
+        data: initialData
+      });
+    });
+
+    this.trigger('query', {});
+
+    // Hide the original select
+
+    $element.hide();
+    $element.attr('tabindex', '-1');
+
+    $element.data('select2', this);
+  };
+
+  Utils.Extend(Select2, Utils.Observable);
+
+  Select2.prototype._generateId = function ($element) {
+    var id = '';
+
+    if ($element.attr('id') != null) {
+      id = $element.attr('id');
+    } else if ($element.attr('name') != null) {
+      id = $element.attr('name') + '-' + Utils.generateChars(2);
+    } else {
+      id = Utils.generateChars(4);
+    }
+
+    id = 'select2-' + id;
+
+    return id;
+  };
+
+  Select2.prototype._placeContainer = function ($container) {
+    $container.insertAfter(this.$element);
+    $container.width(this.$element.outerWidth(false));
+  };
+
+  Select2.prototype._placeSelection = function ($selection) {
+    var $selectionContainer = this.$container.find('.selection');
+    $selectionContainer.append($selection);
+  };
+
+  Select2.prototype._placeDropdown = function ($dropdown) {
+    this.$dropdown = $dropdown;
+
+    var $dropdownContainer = this.$container.find('.dropdown-wrapper');
+    $dropdownContainer.append($dropdown);
+  };
+
+  Select2.prototype._placeResults = function ($results) {
+    var $resultsContainer = this.$dropdown.find('.results');
+    $resultsContainer.append($results);
+  };
+
+  Select2.prototype._bindAdapters = function () {
+    this.data.bind(this, this.$container);
+    this.selection.bind(this, this.$container);
+
+    this.dropdown.bind(this, this.$container);
+    this.results.bind(this, this.$container);
+  };
+
+  Select2.prototype._registerDomEvents = function () {
+    var self = this;
 
     this.$element.on('change', function () {
       self.data.current(function (data) {
@@ -1679,6 +1753,10 @@ define('select2/core',[
         });
       });
     });
+  };
+
+  Select2.prototype._registerSelectionEvents = function () {
+    var self = this;
 
     this.selection.on('open', function () {
       self.open();
@@ -1705,6 +1783,10 @@ define('select2/core',[
 
       self.close();
     });
+  };
+
+  Select2.prototype._registerResultsEvents = function () {
+    var self = this;
 
     this.results.on('selected', function (params) {
       self.trigger('select', params);
@@ -1721,21 +1803,17 @@ define('select2/core',[
     this.results.on('results:focus', function (params) {
       self.trigger('results:focus', params);
     });
+  };
+
+  Select2.prototype._registerEvents = function () {
+    var self = this;
 
     this.on('open', function () {
-      $container.addClass('open');
+      self.$container.addClass('open');
     });
 
     this.on('close', function () {
-      $container.removeClass('open');
-    });
-
-    // Set the initial state
-
-    this.data.current(function (initialData) {
-      self.trigger('selection:update', {
-        data: initialData
-      });
+      self.$container.removeClass('open');
     });
 
     this.on('query', function (params) {
@@ -1746,55 +1824,6 @@ define('select2/core',[
         });
       });
     });
-
-    this.trigger('query', {});
-
-    // Hide the original select
-
-    $element.hide();
-    $element.attr('tabindex', '-1');
-
-    $element.data('select2', this);
-  };
-
-  Utils.Extend(Select2, Utils.Observable);
-
-  Select2.prototype._generateId = function ($element) {
-    var id = '';
-
-    if ($element.attr('id') != null) {
-      id = $element.attr('id');
-    } else if ($element.attr('name') != null) {
-      id = $element.attr('name') + '-' + Utils.generateChars(2);
-    } else {
-      id = Utils.generateChars(4);
-    }
-
-    id = 'select2-' + id;
-
-    return id;
-  };
-
-  Select2.prototype._placeContainer = function ($container) {
-    $container.insertAfter(this.$element);
-    $container.width(this.$element.outerWidth(false));
-  };
-
-  Select2.prototype._placeSelection = function ($selection) {
-    var $selectionContainer = this.$container.find('.selection');
-    $selectionContainer.append($selection);
-  };
-
-  Select2.prototype._placeDropdown = function ($dropdown) {
-    this.$dropdown = $dropdown;
-
-    var $dropdownContainer = this.$container.find('.dropdown-wrapper');
-    $dropdownContainer.append($dropdown);
-  };
-
-  Select2.prototype._placeResults = function ($results) {
-    var $resultsContainer = this.$dropdown.find('.results');
-    $resultsContainer.append($results);
   };
 
   Select2.prototype.toggleDropdown = function () {

+ 92 - 63
dist/js/select2.amd.js

@@ -1666,11 +1666,85 @@ define('select2/core',[
 
     var self = this;
 
-    this.data.bind(this, $container);
-    this.selection.bind(this, $container);
+    // Bind the container to all of the adapters
+    this._bindAdapters();
 
-    this.dropdown.bind(this, $container);
-    this.results.bind(this, $container);
+    // Register any DOM event handler
+    this._registerDomEvents();
+
+    // Register any internal event handlers
+    this._registerSelectionEvents();
+    this._registerResultsEvents();
+    this._registerEvents();
+
+    // Set the initial state
+
+    this.data.current(function (initialData) {
+      self.trigger('selection:update', {
+        data: initialData
+      });
+    });
+
+    this.trigger('query', {});
+
+    // Hide the original select
+
+    $element.hide();
+    $element.attr('tabindex', '-1');
+
+    $element.data('select2', this);
+  };
+
+  Utils.Extend(Select2, Utils.Observable);
+
+  Select2.prototype._generateId = function ($element) {
+    var id = '';
+
+    if ($element.attr('id') != null) {
+      id = $element.attr('id');
+    } else if ($element.attr('name') != null) {
+      id = $element.attr('name') + '-' + Utils.generateChars(2);
+    } else {
+      id = Utils.generateChars(4);
+    }
+
+    id = 'select2-' + id;
+
+    return id;
+  };
+
+  Select2.prototype._placeContainer = function ($container) {
+    $container.insertAfter(this.$element);
+    $container.width(this.$element.outerWidth(false));
+  };
+
+  Select2.prototype._placeSelection = function ($selection) {
+    var $selectionContainer = this.$container.find('.selection');
+    $selectionContainer.append($selection);
+  };
+
+  Select2.prototype._placeDropdown = function ($dropdown) {
+    this.$dropdown = $dropdown;
+
+    var $dropdownContainer = this.$container.find('.dropdown-wrapper');
+    $dropdownContainer.append($dropdown);
+  };
+
+  Select2.prototype._placeResults = function ($results) {
+    var $resultsContainer = this.$dropdown.find('.results');
+    $resultsContainer.append($results);
+  };
+
+  Select2.prototype._bindAdapters = function () {
+    this.data.bind(this, this.$container);
+    this.selection.bind(this, this.$container);
+
+    this.dropdown.bind(this, this.$container);
+    this.results.bind(this, this.$container);
+  };
+
+  Select2.prototype._registerDomEvents = function () {
+    var self = this;
 
     this.$element.on('change', function () {
       self.data.current(function (data) {
@@ -1679,6 +1753,10 @@ define('select2/core',[
         });
       });
     });
+  };
+
+  Select2.prototype._registerSelectionEvents = function () {
+    var self = this;
 
     this.selection.on('open', function () {
       self.open();
@@ -1705,6 +1783,10 @@ define('select2/core',[
 
       self.close();
     });
+  };
+
+  Select2.prototype._registerResultsEvents = function () {
+    var self = this;
 
     this.results.on('selected', function (params) {
       self.trigger('select', params);
@@ -1721,21 +1803,17 @@ define('select2/core',[
     this.results.on('results:focus', function (params) {
       self.trigger('results:focus', params);
     });
+  };
+
+  Select2.prototype._registerEvents = function () {
+    var self = this;
 
     this.on('open', function () {
-      $container.addClass('open');
+      self.$container.addClass('open');
     });
 
     this.on('close', function () {
-      $container.removeClass('open');
-    });
-
-    // Set the initial state
-
-    this.data.current(function (initialData) {
-      self.trigger('selection:update', {
-        data: initialData
-      });
+      self.$container.removeClass('open');
     });
 
     this.on('query', function (params) {
@@ -1746,55 +1824,6 @@ define('select2/core',[
         });
       });
     });
-
-    this.trigger('query', {});
-
-    // Hide the original select
-
-    $element.hide();
-    $element.attr('tabindex', '-1');
-
-    $element.data('select2', this);
-  };
-
-  Utils.Extend(Select2, Utils.Observable);
-
-  Select2.prototype._generateId = function ($element) {
-    var id = '';
-
-    if ($element.attr('id') != null) {
-      id = $element.attr('id');
-    } else if ($element.attr('name') != null) {
-      id = $element.attr('name') + '-' + Utils.generateChars(2);
-    } else {
-      id = Utils.generateChars(4);
-    }
-
-    id = 'select2-' + id;
-
-    return id;
-  };
-
-  Select2.prototype._placeContainer = function ($container) {
-    $container.insertAfter(this.$element);
-    $container.width(this.$element.outerWidth(false));
-  };
-
-  Select2.prototype._placeSelection = function ($selection) {
-    var $selectionContainer = this.$container.find('.selection');
-    $selectionContainer.append($selection);
-  };
-
-  Select2.prototype._placeDropdown = function ($dropdown) {
-    this.$dropdown = $dropdown;
-
-    var $dropdownContainer = this.$container.find('.dropdown-wrapper');
-    $dropdownContainer.append($dropdown);
-  };
-
-  Select2.prototype._placeResults = function ($results) {
-    var $resultsContainer = this.$dropdown.find('.results');
-    $resultsContainer.append($results);
   };
 
   Select2.prototype.toggleDropdown = function () {

+ 92 - 63
dist/js/select2.full.js

@@ -11201,11 +11201,85 @@ define('select2/core',[
 
     var self = this;
 
-    this.data.bind(this, $container);
-    this.selection.bind(this, $container);
+    // Bind the container to all of the adapters
+    this._bindAdapters();
 
-    this.dropdown.bind(this, $container);
-    this.results.bind(this, $container);
+    // Register any DOM event handler
+    this._registerDomEvents();
+
+    // Register any internal event handlers
+    this._registerSelectionEvents();
+    this._registerResultsEvents();
+    this._registerEvents();
+
+    // Set the initial state
+
+    this.data.current(function (initialData) {
+      self.trigger('selection:update', {
+        data: initialData
+      });
+    });
+
+    this.trigger('query', {});
+
+    // Hide the original select
+
+    $element.hide();
+    $element.attr('tabindex', '-1');
+
+    $element.data('select2', this);
+  };
+
+  Utils.Extend(Select2, Utils.Observable);
+
+  Select2.prototype._generateId = function ($element) {
+    var id = '';
+
+    if ($element.attr('id') != null) {
+      id = $element.attr('id');
+    } else if ($element.attr('name') != null) {
+      id = $element.attr('name') + '-' + Utils.generateChars(2);
+    } else {
+      id = Utils.generateChars(4);
+    }
+
+    id = 'select2-' + id;
+
+    return id;
+  };
+
+  Select2.prototype._placeContainer = function ($container) {
+    $container.insertAfter(this.$element);
+    $container.width(this.$element.outerWidth(false));
+  };
+
+  Select2.prototype._placeSelection = function ($selection) {
+    var $selectionContainer = this.$container.find('.selection');
+    $selectionContainer.append($selection);
+  };
+
+  Select2.prototype._placeDropdown = function ($dropdown) {
+    this.$dropdown = $dropdown;
+
+    var $dropdownContainer = this.$container.find('.dropdown-wrapper');
+    $dropdownContainer.append($dropdown);
+  };
+
+  Select2.prototype._placeResults = function ($results) {
+    var $resultsContainer = this.$dropdown.find('.results');
+    $resultsContainer.append($results);
+  };
+
+  Select2.prototype._bindAdapters = function () {
+    this.data.bind(this, this.$container);
+    this.selection.bind(this, this.$container);
+
+    this.dropdown.bind(this, this.$container);
+    this.results.bind(this, this.$container);
+  };
+
+  Select2.prototype._registerDomEvents = function () {
+    var self = this;
 
     this.$element.on('change', function () {
       self.data.current(function (data) {
@@ -11214,6 +11288,10 @@ define('select2/core',[
         });
       });
     });
+  };
+
+  Select2.prototype._registerSelectionEvents = function () {
+    var self = this;
 
     this.selection.on('open', function () {
       self.open();
@@ -11240,6 +11318,10 @@ define('select2/core',[
 
       self.close();
     });
+  };
+
+  Select2.prototype._registerResultsEvents = function () {
+    var self = this;
 
     this.results.on('selected', function (params) {
       self.trigger('select', params);
@@ -11256,21 +11338,17 @@ define('select2/core',[
     this.results.on('results:focus', function (params) {
       self.trigger('results:focus', params);
     });
+  };
+
+  Select2.prototype._registerEvents = function () {
+    var self = this;
 
     this.on('open', function () {
-      $container.addClass('open');
+      self.$container.addClass('open');
     });
 
     this.on('close', function () {
-      $container.removeClass('open');
-    });
-
-    // Set the initial state
-
-    this.data.current(function (initialData) {
-      self.trigger('selection:update', {
-        data: initialData
-      });
+      self.$container.removeClass('open');
     });
 
     this.on('query', function (params) {
@@ -11281,55 +11359,6 @@ define('select2/core',[
         });
       });
     });
-
-    this.trigger('query', {});
-
-    // Hide the original select
-
-    $element.hide();
-    $element.attr('tabindex', '-1');
-
-    $element.data('select2', this);
-  };
-
-  Utils.Extend(Select2, Utils.Observable);
-
-  Select2.prototype._generateId = function ($element) {
-    var id = '';
-
-    if ($element.attr('id') != null) {
-      id = $element.attr('id');
-    } else if ($element.attr('name') != null) {
-      id = $element.attr('name') + '-' + Utils.generateChars(2);
-    } else {
-      id = Utils.generateChars(4);
-    }
-
-    id = 'select2-' + id;
-
-    return id;
-  };
-
-  Select2.prototype._placeContainer = function ($container) {
-    $container.insertAfter(this.$element);
-    $container.width(this.$element.outerWidth(false));
-  };
-
-  Select2.prototype._placeSelection = function ($selection) {
-    var $selectionContainer = this.$container.find('.selection');
-    $selectionContainer.append($selection);
-  };
-
-  Select2.prototype._placeDropdown = function ($dropdown) {
-    this.$dropdown = $dropdown;
-
-    var $dropdownContainer = this.$container.find('.dropdown-wrapper');
-    $dropdownContainer.append($dropdown);
-  };
-
-  Select2.prototype._placeResults = function ($results) {
-    var $resultsContainer = this.$dropdown.find('.results');
-    $resultsContainer.append($results);
   };
 
   Select2.prototype.toggleDropdown = function () {

File diff suppressed because it is too large
+ 0 - 0
dist/js/select2.full.min.js


+ 92 - 63
dist/js/select2.js

@@ -2094,11 +2094,85 @@ define('select2/core',[
 
     var self = this;
 
-    this.data.bind(this, $container);
-    this.selection.bind(this, $container);
+    // Bind the container to all of the adapters
+    this._bindAdapters();
 
-    this.dropdown.bind(this, $container);
-    this.results.bind(this, $container);
+    // Register any DOM event handler
+    this._registerDomEvents();
+
+    // Register any internal event handlers
+    this._registerSelectionEvents();
+    this._registerResultsEvents();
+    this._registerEvents();
+
+    // Set the initial state
+
+    this.data.current(function (initialData) {
+      self.trigger('selection:update', {
+        data: initialData
+      });
+    });
+
+    this.trigger('query', {});
+
+    // Hide the original select
+
+    $element.hide();
+    $element.attr('tabindex', '-1');
+
+    $element.data('select2', this);
+  };
+
+  Utils.Extend(Select2, Utils.Observable);
+
+  Select2.prototype._generateId = function ($element) {
+    var id = '';
+
+    if ($element.attr('id') != null) {
+      id = $element.attr('id');
+    } else if ($element.attr('name') != null) {
+      id = $element.attr('name') + '-' + Utils.generateChars(2);
+    } else {
+      id = Utils.generateChars(4);
+    }
+
+    id = 'select2-' + id;
+
+    return id;
+  };
+
+  Select2.prototype._placeContainer = function ($container) {
+    $container.insertAfter(this.$element);
+    $container.width(this.$element.outerWidth(false));
+  };
+
+  Select2.prototype._placeSelection = function ($selection) {
+    var $selectionContainer = this.$container.find('.selection');
+    $selectionContainer.append($selection);
+  };
+
+  Select2.prototype._placeDropdown = function ($dropdown) {
+    this.$dropdown = $dropdown;
+
+    var $dropdownContainer = this.$container.find('.dropdown-wrapper');
+    $dropdownContainer.append($dropdown);
+  };
+
+  Select2.prototype._placeResults = function ($results) {
+    var $resultsContainer = this.$dropdown.find('.results');
+    $resultsContainer.append($results);
+  };
+
+  Select2.prototype._bindAdapters = function () {
+    this.data.bind(this, this.$container);
+    this.selection.bind(this, this.$container);
+
+    this.dropdown.bind(this, this.$container);
+    this.results.bind(this, this.$container);
+  };
+
+  Select2.prototype._registerDomEvents = function () {
+    var self = this;
 
     this.$element.on('change', function () {
       self.data.current(function (data) {
@@ -2107,6 +2181,10 @@ define('select2/core',[
         });
       });
     });
+  };
+
+  Select2.prototype._registerSelectionEvents = function () {
+    var self = this;
 
     this.selection.on('open', function () {
       self.open();
@@ -2133,6 +2211,10 @@ define('select2/core',[
 
       self.close();
     });
+  };
+
+  Select2.prototype._registerResultsEvents = function () {
+    var self = this;
 
     this.results.on('selected', function (params) {
       self.trigger('select', params);
@@ -2149,21 +2231,17 @@ define('select2/core',[
     this.results.on('results:focus', function (params) {
       self.trigger('results:focus', params);
     });
+  };
+
+  Select2.prototype._registerEvents = function () {
+    var self = this;
 
     this.on('open', function () {
-      $container.addClass('open');
+      self.$container.addClass('open');
     });
 
     this.on('close', function () {
-      $container.removeClass('open');
-    });
-
-    // Set the initial state
-
-    this.data.current(function (initialData) {
-      self.trigger('selection:update', {
-        data: initialData
-      });
+      self.$container.removeClass('open');
     });
 
     this.on('query', function (params) {
@@ -2174,55 +2252,6 @@ define('select2/core',[
         });
       });
     });
-
-    this.trigger('query', {});
-
-    // Hide the original select
-
-    $element.hide();
-    $element.attr('tabindex', '-1');
-
-    $element.data('select2', this);
-  };
-
-  Utils.Extend(Select2, Utils.Observable);
-
-  Select2.prototype._generateId = function ($element) {
-    var id = '';
-
-    if ($element.attr('id') != null) {
-      id = $element.attr('id');
-    } else if ($element.attr('name') != null) {
-      id = $element.attr('name') + '-' + Utils.generateChars(2);
-    } else {
-      id = Utils.generateChars(4);
-    }
-
-    id = 'select2-' + id;
-
-    return id;
-  };
-
-  Select2.prototype._placeContainer = function ($container) {
-    $container.insertAfter(this.$element);
-    $container.width(this.$element.outerWidth(false));
-  };
-
-  Select2.prototype._placeSelection = function ($selection) {
-    var $selectionContainer = this.$container.find('.selection');
-    $selectionContainer.append($selection);
-  };
-
-  Select2.prototype._placeDropdown = function ($dropdown) {
-    this.$dropdown = $dropdown;
-
-    var $dropdownContainer = this.$container.find('.dropdown-wrapper');
-    $dropdownContainer.append($dropdown);
-  };
-
-  Select2.prototype._placeResults = function ($results) {
-    var $resultsContainer = this.$dropdown.find('.results');
-    $resultsContainer.append($results);
   };
 
   Select2.prototype.toggleDropdown = function () {

File diff suppressed because it is too large
+ 0 - 0
dist/js/select2.min.js


+ 92 - 63
src/js/select2/core.js

@@ -48,11 +48,85 @@ define([
 
     var self = this;
 
-    this.data.bind(this, $container);
-    this.selection.bind(this, $container);
+    // Bind the container to all of the adapters
+    this._bindAdapters();
 
-    this.dropdown.bind(this, $container);
-    this.results.bind(this, $container);
+    // Register any DOM event handlers
+    this._registerDomEvents();
+
+    // Register any internal event handlers
+    this._registerSelectionEvents();
+    this._registerResultsEvents();
+    this._registerEvents();
+
+    // Set the initial state
+
+    this.data.current(function (initialData) {
+      self.trigger('selection:update', {
+        data: initialData
+      });
+    });
+
+    this.trigger('query', {});
+
+    // Hide the original select
+
+    $element.hide();
+    $element.attr('tabindex', '-1');
+
+    $element.data('select2', this);
+  };
+
+  Utils.Extend(Select2, Utils.Observable);
+
+  Select2.prototype._generateId = function ($element) {
+    var id = '';
+
+    if ($element.attr('id') != null) {
+      id = $element.attr('id');
+    } else if ($element.attr('name') != null) {
+      id = $element.attr('name') + '-' + Utils.generateChars(2);
+    } else {
+      id = Utils.generateChars(4);
+    }
+
+    id = 'select2-' + id;
+
+    return id;
+  };
+
+  Select2.prototype._placeContainer = function ($container) {
+    $container.insertAfter(this.$element);
+    $container.width(this.$element.outerWidth(false));
+  };
+
+  Select2.prototype._placeSelection = function ($selection) {
+    var $selectionContainer = this.$container.find('.selection');
+    $selectionContainer.append($selection);
+  };
+
+  Select2.prototype._placeDropdown = function ($dropdown) {
+    this.$dropdown = $dropdown;
+
+    var $dropdownContainer = this.$container.find('.dropdown-wrapper');
+    $dropdownContainer.append($dropdown);
+  };
+
+  Select2.prototype._placeResults = function ($results) {
+    var $resultsContainer = this.$dropdown.find('.results');
+    $resultsContainer.append($results);
+  };
+
+  Select2.prototype._bindAdapters = function () {
+    this.data.bind(this, this.$container);
+    this.selection.bind(this, this.$container);
+
+    this.dropdown.bind(this, this.$container);
+    this.results.bind(this, this.$container);
+  };
+
+  Select2.prototype._registerDomEvents = function () {
+    var self = this;
 
     this.$element.on('change', function () {
       self.data.current(function (data) {
@@ -61,6 +135,10 @@ define([
         });
       });
     });
+  };
+
+  Select2.prototype._registerSelectionEvents = function () {
+    var self = this;
 
     this.selection.on('open', function () {
       self.open();
@@ -87,6 +165,10 @@ define([
 
       self.close();
     });
+  };
+
+  Select2.prototype._registerResultsEvents = function () {
+    var self = this;
 
     this.results.on('selected', function (params) {
       self.trigger('select', params);
@@ -103,21 +185,17 @@ define([
     this.results.on('results:focus', function (params) {
       self.trigger('results:focus', params);
     });
+  };
+
+  Select2.prototype._registerEvents = function () {
+    var self = this;
 
     this.on('open', function () {
-      $container.addClass('open');
+      self.$container.addClass('open');
     });
 
     this.on('close', function () {
-      $container.removeClass('open');
-    });
-
-    // Set the initial state
-
-    this.data.current(function (initialData) {
-      self.trigger('selection:update', {
-        data: initialData
-      });
+      self.$container.removeClass('open');
     });
 
     this.on('query', function (params) {
@@ -128,55 +206,6 @@ define([
         });
       });
     });
-
-    this.trigger('query', {});
-
-    // Hide the original select
-
-    $element.hide();
-    $element.attr('tabindex', '-1');
-
-    $element.data('select2', this);
-  };
-
-  Utils.Extend(Select2, Utils.Observable);
-
-  Select2.prototype._generateId = function ($element) {
-    var id = '';
-
-    if ($element.attr('id') != null) {
-      id = $element.attr('id');
-    } else if ($element.attr('name') != null) {
-      id = $element.attr('name') + '-' + Utils.generateChars(2);
-    } else {
-      id = Utils.generateChars(4);
-    }
-
-    id = 'select2-' + id;
-
-    return id;
-  };
-
-  Select2.prototype._placeContainer = function ($container) {
-    $container.insertAfter(this.$element);
-    $container.width(this.$element.outerWidth(false));
-  };
-
-  Select2.prototype._placeSelection = function ($selection) {
-    var $selectionContainer = this.$container.find('.selection');
-    $selectionContainer.append($selection);
-  };
-
-  Select2.prototype._placeDropdown = function ($dropdown) {
-    this.$dropdown = $dropdown;
-
-    var $dropdownContainer = this.$container.find('.dropdown-wrapper');
-    $dropdownContainer.append($dropdown);
-  };
-
-  Select2.prototype._placeResults = function ($results) {
-    var $resultsContainer = this.$dropdown.find('.results');
-    $resultsContainer.append($results);
   };
 
   Select2.prototype.toggleDropdown = function () {

Some files were not shown because too many files changed in this diff