Skip to content

Commit 338a126

Browse files
committed
Always call createSearchChoice and tokenizer with the Select2 object as this.
1 parent 476b34b commit 338a126

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

select2.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ the specific language governing permissions and limitations under the Apache Lic
598598
input = input.substring(index + separator.length);
599599

600600
if (token.length > 0) {
601-
token = opts.createSearchChoice(token, selection);
601+
token = opts.createSearchChoice.call(this, token, selection);
602602
if (token !== undefined && token !== null && opts.id(token) !== undefined && opts.id(token) !== null) {
603603
dupe = false;
604604
for (i = 0, l = selection.length; i < l; i++) {
@@ -1586,7 +1586,7 @@ the specific language governing permissions and limitations under the Apache Lic
15861586
this.context = (data.context===undefined) ? null : data.context;
15871587
// create a default choice and prepend it to the list
15881588
if (this.opts.createSearchChoice && search.val() !== "") {
1589-
def = this.opts.createSearchChoice.call(null, search.val(), data.results);
1589+
def = this.opts.createSearchChoice.call(self, search.val(), data.results);
15901590
if (def !== undefined && def !== null && self.id(def) !== undefined && self.id(def) !== null) {
15911591
if ($(data.results).filter(
15921592
function () {
@@ -2640,7 +2640,7 @@ the specific language governing permissions and limitations under the Apache Lic
26402640
// multi
26412641
tokenize: function() {
26422642
var input = this.search.val();
2643-
input = this.opts.tokenizer(input, this.data(), this.bind(this.onSelect), this.opts);
2643+
input = this.opts.tokenizer.call(this, input, this.data(), this.bind(this.onSelect), this.opts);
26442644
if (input != null && input != undefined) {
26452645
this.search.val(input);
26462646
if (input.length > 0) {

0 commit comments

Comments
 (0)