export default escapeMarkup function so it can be easily accessed. #1222
This commit is contained in:
parent
4e7a8b00fc
commit
30dac9a40b
35
select2.js
35
select2.js
@ -356,6 +356,22 @@ the specific language governing permissions and limitations under the Apache Lic
|
|||||||
markup.push(escapeMarkup(text.substring(match + tl, text.length)));
|
markup.push(escapeMarkup(text.substring(match + tl, text.length)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function defaultEscapeMarkup(markup) {
|
||||||
|
var replace_map = {
|
||||||
|
'\\': '\',
|
||||||
|
'&': '&',
|
||||||
|
'<': '<',
|
||||||
|
'>': '>',
|
||||||
|
'"': '"',
|
||||||
|
"'": ''',
|
||||||
|
"/": '/'
|
||||||
|
};
|
||||||
|
|
||||||
|
return String(markup).replace(/[&<>"'\/\\]/g, function (match) {
|
||||||
|
return replace_map[match];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Produces an ajax-based query function
|
* Produces an ajax-based query function
|
||||||
*
|
*
|
||||||
@ -3091,21 +3107,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|||||||
separator: ",",
|
separator: ",",
|
||||||
tokenSeparators: [],
|
tokenSeparators: [],
|
||||||
tokenizer: defaultTokenizer,
|
tokenizer: defaultTokenizer,
|
||||||
escapeMarkup: function (markup) {
|
escapeMarkup: defaultEscapeMarkup,
|
||||||
var replace_map = {
|
|
||||||
'\\': '\',
|
|
||||||
'&': '&',
|
|
||||||
'<': '<',
|
|
||||||
'>': '>',
|
|
||||||
'"': '"',
|
|
||||||
"'": ''',
|
|
||||||
"/": '/'
|
|
||||||
};
|
|
||||||
|
|
||||||
return String(markup).replace(/[&<>"'\/\\]/g, function (match) {
|
|
||||||
return replace_map[match];
|
|
||||||
});
|
|
||||||
},
|
|
||||||
blurOnChange: false,
|
blurOnChange: false,
|
||||||
selectOnBlur: false,
|
selectOnBlur: false,
|
||||||
adaptContainerCssClass: function(c) { return c; },
|
adaptContainerCssClass: function(c) { return c; },
|
||||||
@ -3129,7 +3131,8 @@ the specific language governing permissions and limitations under the Apache Lic
|
|||||||
tags: tags
|
tags: tags
|
||||||
}, util: {
|
}, util: {
|
||||||
debounce: debounce,
|
debounce: debounce,
|
||||||
markMatch: markMatch
|
markMatch: markMatch,
|
||||||
|
escapeMarkup: defaultEscapeMarkup
|
||||||
}, "class": {
|
}, "class": {
|
||||||
"abstract": AbstractSelect2,
|
"abstract": AbstractSelect2,
|
||||||
"single": SingleSelect2,
|
"single": SingleSelect2,
|
||||||
|
Loading…
Reference in New Issue
Block a user