فهرست منبع

Clone the options for group elements

This will always clone the options that are passed in when
initializing Select2 on multiple objects (like `$("select")`) so
it doesn't always assume that the configuration is the exact same.
This prevents any reference-based tricks for modifying the data
within Select2, but some would look at that as an upside.
Kevin Brown 10 سال پیش
والد
کامیت
f1e86470ca
7فایلهای تغییر یافته به همراه30 افزوده شده و 10 حذف شده
  1. 6 2
      dist/js/select2.amd.full.js
  2. 6 2
      dist/js/select2.amd.js
  3. 6 2
      dist/js/select2.full.js
  4. 0 0
      dist/js/select2.full.min.js
  5. 6 2
      dist/js/select2.js
  6. 0 0
      dist/js/select2.min.js
  7. 6 2
      src/js/jquery.select2.js

+ 6 - 2
dist/js/select2.amd.full.js

@@ -4065,13 +4065,17 @@ define('jquery.select2',[
 
       if (typeof options === 'object') {
         this.each(function () {
-          var instance = new Select2($(this), options);
+          var instanceOptions = $.extend({}, options, true);
+
+          var instance = new Select2($(this), instanceOptions);
         });
+
+        return this;
       } else if (typeof options === 'string') {
         var instance = this.data('select2');
         var args = Array.prototype.slice.call(arguments, 1);
 
-        instance[options](args);
+        return instance[options](args);
       } else {
         throw new Error('Invalid arguments for Select2: ' + options);
       }

+ 6 - 2
dist/js/select2.amd.js

@@ -4003,13 +4003,17 @@ define('jquery.select2',[
 
       if (typeof options === 'object') {
         this.each(function () {
-          var instance = new Select2($(this), options);
+          var instanceOptions = $.extend({}, options, true);
+
+          var instance = new Select2($(this), instanceOptions);
         });
+
+        return this;
       } else if (typeof options === 'string') {
         var instance = this.data('select2');
         var args = Array.prototype.slice.call(arguments, 1);
 
-        instance[options](args);
+        return instance[options](args);
       } else {
         throw new Error('Invalid arguments for Select2: ' + options);
       }

+ 6 - 2
dist/js/select2.full.js

@@ -13600,13 +13600,17 @@ define('jquery.select2',[
 
       if (typeof options === 'object') {
         this.each(function () {
-          var instance = new Select2($(this), options);
+          var instanceOptions = $.extend({}, options, true);
+
+          var instance = new Select2($(this), instanceOptions);
         });
+
+        return this;
       } else if (typeof options === 'string') {
         var instance = this.data('select2');
         var args = Array.prototype.slice.call(arguments, 1);
 
-        instance[options](args);
+        return instance[options](args);
       } else {
         throw new Error('Invalid arguments for Select2: ' + options);
       }

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 0
dist/js/select2.full.min.js


+ 6 - 2
dist/js/select2.js

@@ -4431,13 +4431,17 @@ define('jquery.select2',[
 
       if (typeof options === 'object') {
         this.each(function () {
-          var instance = new Select2($(this), options);
+          var instanceOptions = $.extend({}, options, true);
+
+          var instance = new Select2($(this), instanceOptions);
         });
+
+        return this;
       } else if (typeof options === 'string') {
         var instance = this.data('select2');
         var args = Array.prototype.slice.call(arguments, 1);
 
-        instance[options](args);
+        return instance[options](args);
       } else {
         throw new Error('Invalid arguments for Select2: ' + options);
       }

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 0
dist/js/select2.min.js


+ 6 - 2
src/js/jquery.select2.js

@@ -8,13 +8,17 @@ define([
 
       if (typeof options === 'object') {
         this.each(function () {
-          var instance = new Select2($(this), options);
+          var instanceOptions = $.extend({}, options, true);
+
+          var instance = new Select2($(this), instanceOptions);
         });
+
+        return this;
       } else if (typeof options === 'string') {
         var instance = this.data('select2');
         var args = Array.prototype.slice.call(arguments, 1);
 
-        instance[options](args);
+        return instance[options](args);
       } else {
         throw new Error('Invalid arguments for Select2: ' + options);
       }

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است