فهرست منبع

Added back `select2("enable")`

This also adds a console warning if the `enable` or `val` method is
called.
Kevin Brown 10 سال پیش
والد
کامیت
3ff78d8145
7فایلهای تغییر یافته به همراه125 افزوده شده و 0 حذف شده
  1. 25 0
      dist/js/select2.amd.full.js
  2. 25 0
      dist/js/select2.amd.js
  3. 25 0
      dist/js/select2.full.js
  4. 0 0
      dist/js/select2.full.min.js
  5. 25 0
      dist/js/select2.js
  6. 0 0
      dist/js/select2.min.js
  7. 25 0
      src/js/select2/core.js

+ 25 - 0
dist/js/select2.amd.full.js

@@ -3750,7 +3750,32 @@ define('select2/core',[
     return this.$container.hasClass('select2-container--open');
   };
 
+  Select2.prototype.enable = function (args) {
+    if (console && console.warn) {
+      console.warn(
+        'Select2: The `select2("val")` method has been deprecated and will be' +
+        ' removed in later Select2 versions. Use $element.prop("disabled") ' +
+        'instead.'
+      );
+    }
+
+    if (args.length === 0) {
+      args = [true];
+    }
+
+    var disabled = !args[0];
+
+    this.$element.prop('disabled', disabled);
+  };
+
   Select2.prototype.val = function (args) {
+    if (console && console.warn) {
+      console.warn(
+        'Select2: The `select2("val")` method has been deprecated and will be' +
+        ' removed in later Select2 versions. Use $element.val() instead.'
+      );
+    }
+
     if (args.length === 0) {
       return this.$element.val();
     }

+ 25 - 0
dist/js/select2.amd.js

@@ -3750,7 +3750,32 @@ define('select2/core',[
     return this.$container.hasClass('select2-container--open');
   };
 
+  Select2.prototype.enable = function (args) {
+    if (console && console.warn) {
+      console.warn(
+        'Select2: The `select2("val")` method has been deprecated and will be' +
+        ' removed in later Select2 versions. Use $element.prop("disabled") ' +
+        'instead.'
+      );
+    }
+
+    if (args.length === 0) {
+      args = [true];
+    }
+
+    var disabled = !args[0];
+
+    this.$element.prop('disabled', disabled);
+  };
+
   Select2.prototype.val = function (args) {
+    if (console && console.warn) {
+      console.warn(
+        'Select2: The `select2("val")` method has been deprecated and will be' +
+        ' removed in later Select2 versions. Use $element.val() instead.'
+      );
+    }
+
     if (args.length === 0) {
       return this.$element.val();
     }

+ 25 - 0
dist/js/select2.full.js

@@ -13285,7 +13285,32 @@ define('select2/core',[
     return this.$container.hasClass('select2-container--open');
   };
 
+  Select2.prototype.enable = function (args) {
+    if (console && console.warn) {
+      console.warn(
+        'Select2: The `select2("val")` method has been deprecated and will be' +
+        ' removed in later Select2 versions. Use $element.prop("disabled") ' +
+        'instead.'
+      );
+    }
+
+    if (args.length === 0) {
+      args = [true];
+    }
+
+    var disabled = !args[0];
+
+    this.$element.prop('disabled', disabled);
+  };
+
   Select2.prototype.val = function (args) {
+    if (console && console.warn) {
+      console.warn(
+        'Select2: The `select2("val")` method has been deprecated and will be' +
+        ' removed in later Select2 versions. Use $element.val() instead.'
+      );
+    }
+
     if (args.length === 0) {
       return this.$element.val();
     }

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


+ 25 - 0
dist/js/select2.js

@@ -4178,7 +4178,32 @@ define('select2/core',[
     return this.$container.hasClass('select2-container--open');
   };
 
+  Select2.prototype.enable = function (args) {
+    if (console && console.warn) {
+      console.warn(
+        'Select2: The `select2("val")` method has been deprecated and will be' +
+        ' removed in later Select2 versions. Use $element.prop("disabled") ' +
+        'instead.'
+      );
+    }
+
+    if (args.length === 0) {
+      args = [true];
+    }
+
+    var disabled = !args[0];
+
+    this.$element.prop('disabled', disabled);
+  };
+
   Select2.prototype.val = function (args) {
+    if (console && console.warn) {
+      console.warn(
+        'Select2: The `select2("val")` method has been deprecated and will be' +
+        ' removed in later Select2 versions. Use $element.val() instead.'
+      );
+    }
+
     if (args.length === 0) {
       return this.$element.val();
     }

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


+ 25 - 0
src/js/select2/core.js

@@ -297,7 +297,32 @@ define([
     return this.$container.hasClass('select2-container--open');
   };
 
+  Select2.prototype.enable = function (args) {
+    if (console && console.warn) {
+      console.warn(
+        'Select2: The `select2("val")` method has been deprecated and will be' +
+        ' removed in later Select2 versions. Use $element.prop("disabled") ' +
+        'instead.'
+      );
+    }
+
+    if (args.length === 0) {
+      args = [true];
+    }
+
+    var disabled = !args[0];
+
+    this.$element.prop('disabled', disabled);
+  };
+
   Select2.prototype.val = function (args) {
+    if (console && console.warn) {
+      console.warn(
+        'Select2: The `select2("val")` method has been deprecated and will be' +
+        ' removed in later Select2 versions. Use $element.val() instead.'
+      );
+    }
+
     if (args.length === 0) {
       return this.$element.val();
     }

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