|
@@ -1,5 +1,5 @@
|
|
|
/*!
|
|
|
- * Select2 4.0.9
|
|
|
+ * Select2 4.0.10
|
|
|
* https://select2.github.io
|
|
|
*
|
|
|
* Released under the MIT license
|
|
@@ -4306,7 +4306,7 @@ S2.define('select2/dropdown/attachBody',[
|
|
|
'../utils'
|
|
|
], function ($, Utils) {
|
|
|
function AttachBody (decorated, $element, options) {
|
|
|
- this.$dropdownParent = options.get('dropdownParent') || $(document.body);
|
|
|
+ this.$dropdownParent = $(options.get('dropdownParent') || document.body);
|
|
|
|
|
|
decorated.call(this, $element, options);
|
|
|
}
|
|
@@ -4319,6 +4319,9 @@ S2.define('select2/dropdown/attachBody',[
|
|
|
container.on('open', function () {
|
|
|
self._showDropdown();
|
|
|
self._attachPositioningHandler(container);
|
|
|
+
|
|
|
+ // Must bind after the results handlers to ensure correct sizing
|
|
|
+ self._bindContainerResultHandlers(container);
|
|
|
});
|
|
|
|
|
|
container.on('close', function () {
|
|
@@ -4326,31 +4329,6 @@ S2.define('select2/dropdown/attachBody',[
|
|
|
self._detachPositioningHandler(container);
|
|
|
});
|
|
|
|
|
|
- container.on('results:all', function () {
|
|
|
- self._positionDropdown();
|
|
|
- self._resizeDropdown();
|
|
|
- });
|
|
|
-
|
|
|
- container.on('results:append', function () {
|
|
|
- self._positionDropdown();
|
|
|
- self._resizeDropdown();
|
|
|
- });
|
|
|
-
|
|
|
- container.on('results:message', function () {
|
|
|
- self._positionDropdown();
|
|
|
- self._resizeDropdown();
|
|
|
- });
|
|
|
-
|
|
|
- container.on('select', function () {
|
|
|
- self._positionDropdown();
|
|
|
- self._resizeDropdown();
|
|
|
- });
|
|
|
-
|
|
|
- container.on('unselect', function () {
|
|
|
- self._positionDropdown();
|
|
|
- self._resizeDropdown();
|
|
|
- });
|
|
|
-
|
|
|
this.$dropdownContainer.on('mousedown', function (evt) {
|
|
|
evt.stopPropagation();
|
|
|
});
|
|
@@ -4392,6 +4370,44 @@ S2.define('select2/dropdown/attachBody',[
|
|
|
this.$dropdownContainer.detach();
|
|
|
};
|
|
|
|
|
|
+ AttachBody.prototype._bindContainerResultHandlers =
|
|
|
+ function (decorated, container) {
|
|
|
+
|
|
|
+ // These should only be bound once
|
|
|
+ if (this._containerResultsHandlersBound) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ var self = this;
|
|
|
+
|
|
|
+ container.on('results:all', function () {
|
|
|
+ self._positionDropdown();
|
|
|
+ self._resizeDropdown();
|
|
|
+ });
|
|
|
+
|
|
|
+ container.on('results:append', function () {
|
|
|
+ self._positionDropdown();
|
|
|
+ self._resizeDropdown();
|
|
|
+ });
|
|
|
+
|
|
|
+ container.on('results:message', function () {
|
|
|
+ self._positionDropdown();
|
|
|
+ self._resizeDropdown();
|
|
|
+ });
|
|
|
+
|
|
|
+ container.on('select', function () {
|
|
|
+ self._positionDropdown();
|
|
|
+ self._resizeDropdown();
|
|
|
+ });
|
|
|
+
|
|
|
+ container.on('unselect', function () {
|
|
|
+ self._positionDropdown();
|
|
|
+ self._resizeDropdown();
|
|
|
+ });
|
|
|
+
|
|
|
+ this._containerResultsHandlersBound = true;
|
|
|
+ };
|
|
|
+
|
|
|
AttachBody.prototype._attachPositioningHandler =
|
|
|
function (decorated, container) {
|
|
|
var self = this;
|