1
0
mirror of synced 2024-11-22 13:06:08 +03:00

Handle null being returned from createTag

The `createTag` option does allow for `null` to be returned if a
tag should not be created. The tokenizer previously didn't support
this, so the tokenizer should be able to handle this case. Previously
it would trigger an exception, because the tokenizer would pass back
a null value to the select function.

This also fixes what would have been a potential bug where even if a
tag was not created, the term would still have been sliced at the
location of the token. This allows for tokenizers to have special
cases when tokenizing the term, such as not splittting a token
if it is in the middle of a quoted string.

This closes https://github.com/select2/select2/issues/3593
This closes https://github.com/select2/select2/pull/3591
This commit is contained in:
Kevin Brown 2015-08-21 19:12:13 -04:00
parent d9c1cbc976
commit 49589611ee

View File

@ -72,6 +72,11 @@ define([
var data = createTag(partParams);
if (data == null) {
i++;
continue;
}
callback(data);
// Reset the term to not include the tokenized portion