Skip to content

Commit b8c203c

Browse files
committed
1 parent 81b98e7 commit b8c203c

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

select2.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3041,7 +3041,8 @@ the specific language governing permissions and limitations under the Apache Lic
30413041
select2,
30423042
method, value, multiple,
30433043
allowedMethods = ["val", "destroy", "opened", "open", "close", "focus", "isFocused", "container", "dropdown", "onSortStart", "onSortEnd", "enable", "readonly", "positionDropdown", "data", "search"],
3044-
valueMethods = ["val", "opened", "isFocused", "container", "data"],
3044+
valueMethods = ["opened", "isFocused", "container", "dropdown"],
3045+
propertyMethods = ["val", "data"],
30453046
methodsMap = { search: "externalSearch" };
30463047

30473048
this.each(function () {
@@ -3079,8 +3080,9 @@ the specific language governing permissions and limitations under the Apache Lic
30793080

30803081
value = select2[method].apply(select2, args.slice(1));
30813082
}
3082-
if (indexOf(args[0], valueMethods) >= 0) {
3083-
return false;
3083+
if (indexOf(args[0], valueMethods) >= 0
3084+
|| (indexOf(args[0], propertyMethods) && args.length == 1)) {
3085+
return false; // abort the iteration, ready to return first matched value
30843086
}
30853087
} else {
30863088
throw "Invalid arguments to select2 plugin: " + args;

0 commit comments

Comments
 (0)