From b8c203ca363b1acb1fa183dc34cb99653d2d1832 Mon Sep 17 00:00:00 2001 From: Igor Vaynberg Date: Wed, 3 Jul 2013 23:08:55 -0700 Subject: [PATCH] fix #1478 --- select2.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/select2.js b/select2.js index 84e67f22..cba801f8 100644 --- a/select2.js +++ b/select2.js @@ -3041,7 +3041,8 @@ the specific language governing permissions and limitations under the Apache Lic select2, method, value, multiple, allowedMethods = ["val", "destroy", "opened", "open", "close", "focus", "isFocused", "container", "dropdown", "onSortStart", "onSortEnd", "enable", "readonly", "positionDropdown", "data", "search"], - valueMethods = ["val", "opened", "isFocused", "container", "data"], + valueMethods = ["opened", "isFocused", "container", "dropdown"], + propertyMethods = ["val", "data"], methodsMap = { search: "externalSearch" }; this.each(function () { @@ -3079,8 +3080,9 @@ the specific language governing permissions and limitations under the Apache Lic value = select2[method].apply(select2, args.slice(1)); } - if (indexOf(args[0], valueMethods) >= 0) { - return false; + if (indexOf(args[0], valueMethods) >= 0 + || (indexOf(args[0], propertyMethods) && args.length == 1)) { + return false; // abort the iteration, ready to return first matched value } } else { throw "Invalid arguments to select2 plugin: " + args;