소스 검색

Handle special characters in object ids

Slight performance hit as we are no longer using `qurySelectorAll`,
but it handles the situation a bit more cleanly and prevent future
issues with special characters.

This closes https://github.com/select2/select2/issues/3157.
Kevin Brown 10 년 전
부모
커밋
14279a012b
5개의 변경된 파일9개의 추가작업 그리고 3개의 파일을 삭제
  1. 3 1
      dist/js/select2.full.js
  2. 0 0
      dist/js/select2.full.min.js
  3. 3 1
      dist/js/select2.js
  4. 0 0
      dist/js/select2.min.js
  5. 3 1
      src/js/select2/data/array.js

+ 3 - 1
dist/js/select2.full.js

@@ -3136,7 +3136,9 @@ S2.define('select2/data/array',[
   Utils.Extend(ArrayAdapter, SelectAdapter);
 
   ArrayAdapter.prototype.select = function (data) {
-    var $option = this.$element.find('option[value="' + data.id + '"]');
+    var $option = this.$element.find('option').filter(function (i, elm) {
+      return elm.value == data.id.toString();
+    });
 
     if ($option.length === 0) {
       $option = this.option(data);

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
dist/js/select2.full.min.js


+ 3 - 1
dist/js/select2.js

@@ -3136,7 +3136,9 @@ S2.define('select2/data/array',[
   Utils.Extend(ArrayAdapter, SelectAdapter);
 
   ArrayAdapter.prototype.select = function (data) {
-    var $option = this.$element.find('option[value="' + data.id + '"]');
+    var $option = this.$element.find('option').filter(function (i, elm) {
+      return elm.value == data.id.toString();
+    });
 
     if ($option.length === 0) {
       $option = this.option(data);

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
dist/js/select2.min.js


+ 3 - 1
src/js/select2/data/array.js

@@ -14,7 +14,9 @@ define([
   Utils.Extend(ArrayAdapter, SelectAdapter);
 
   ArrayAdapter.prototype.select = function (data) {
-    var $option = this.$element.find('option[value="' + data.id + '"]');
+    var $option = this.$element.find('option').filter(function (i, elm) {
+      return elm.value == data.id.toString();
+    });
 
     if ($option.length === 0) {
       $option = this.option(data);

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.