Prechádzať zdrojové kódy

Fixed string to object conversion

Kevin Brown 10 rokov pred
rodič
commit
fe136088f6

+ 11 - 4
dist/js/select2.amd.full.js

@@ -2322,10 +2322,17 @@ define('select2/data/select',[
   };
 
   SelectAdapter.prototype._normalizeItem = function (item) {
-    $.extend(item, {
-      id: item,
-      text: item
-    });
+    if (!$.isPlainObject(item)) {
+      item = {
+        id: item,
+        text: item
+      };
+    }
+
+    item = $.extend({}, {
+      id: '',
+      text: ''
+    }, item);
 
     var defaults = {
       selected: false,

+ 11 - 4
dist/js/select2.amd.js

@@ -2322,10 +2322,17 @@ define('select2/data/select',[
   };
 
   SelectAdapter.prototype._normalizeItem = function (item) {
-    $.extend(item, {
-      id: item,
-      text: item
-    });
+    if (!$.isPlainObject(item)) {
+      item = {
+        id: item,
+        text: item
+      };
+    }
+
+    item = $.extend({}, {
+      id: '',
+      text: ''
+    }, item);
 
     var defaults = {
       selected: false,

+ 11 - 4
dist/js/select2.full.js

@@ -11857,10 +11857,17 @@ define('select2/data/select',[
   };
 
   SelectAdapter.prototype._normalizeItem = function (item) {
-    $.extend(item, {
-      id: item,
-      text: item
-    });
+    if (!$.isPlainObject(item)) {
+      item = {
+        id: item,
+        text: item
+      };
+    }
+
+    item = $.extend({}, {
+      id: '',
+      text: ''
+    }, item);
 
     var defaults = {
       selected: false,

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 0
dist/js/select2.full.min.js


+ 11 - 4
dist/js/select2.js

@@ -2750,10 +2750,17 @@ define('select2/data/select',[
   };
 
   SelectAdapter.prototype._normalizeItem = function (item) {
-    $.extend(item, {
-      id: item,
-      text: item
-    });
+    if (!$.isPlainObject(item)) {
+      item = {
+        id: item,
+        text: item
+      };
+    }
+
+    item = $.extend({}, {
+      id: '',
+      text: ''
+    }, item);
 
     var defaults = {
       selected: false,

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 0
dist/js/select2.min.js


+ 11 - 4
src/js/select2/data/select.js

@@ -199,10 +199,17 @@ define([
   };
 
   SelectAdapter.prototype._normalizeItem = function (item) {
-    $.extend(item, {
-      id: item,
-      text: item
-    });
+    if (!$.isPlainObject(item)) {
+      item = {
+        id: item,
+        text: item
+      };
+    }
+
+    item = $.extend({}, {
+      id: '',
+      text: ''
+    }, item);
 
     var defaults = {
       selected: false,

Niektoré súbory nie sú zobrazené, pretože je v týchto rozdielových dátach zmenené mnoho súborov