aboutsummaryrefslogtreecommitdiffstats
path: root/themes/default/js/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'themes/default/js/plugins')
-rw-r--r--themes/default/js/plugins/jquery.tokeninput.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/themes/default/js/plugins/jquery.tokeninput.js b/themes/default/js/plugins/jquery.tokeninput.js
index 0c8662b3b..c36a864f2 100644
--- a/themes/default/js/plugins/jquery.tokeninput.js
+++ b/themes/default/js/plugins/jquery.tokeninput.js
@@ -576,7 +576,12 @@ $.TokenList = function (input, url_or_data, settings) {
// Highlight the query part of the search term
function highlight_term(value, term) {
- return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<b>$1</b>");
+ return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + escape_regexp_chars(term) + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<b>$1</b>");
+ }
+
+ function escape_regexp_chars(string) {
+ var specials = new RegExp("[.*+?|()\\[\\]{}\\\\]", "g"); // .*+?|()[]{}\
+ return string.replace(specials, "\\$&");
}
// Populate the results dropdown with some results