Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

typeahead: Remove insecure default highlighter implementation.

Anders Kaseorg118cfbea658f
diff --git a/web/third/bootstrap-typeahead/typeahead.js b/web/third/bootstrap-typeahead/typeahead.js
index 7440c99a9b8..1687b48a9bd 100644
--- a/web/third/bootstrap-typeahead/typeahead.js
+++ b/web/third/bootstrap-typeahead/typeahead.js
@@ -156,7 +156,7 @@ import {get_string_diff} from "../../src/util";
this.options = $.extend({}, $.fn.typeahead.defaults, options)
this.matcher = this.options.matcher || this.matcher
this.sorter = this.options.sorter || this.sorter
- this.highlighter = this.options.highlighter || this.highlighter
+ this.highlighter = this.options.highlighter
this.updater = this.options.updater || this.updater
this.$container = $(this.options.container).appendTo(this.options.parentElement || 'body')
this.$menu = $(this.options.menu).appendTo(this.$container)
@@ -348,13 +348,6 @@ import {get_string_diff} from "../../src/util";
return beginswith.concat(caseSensitive, caseInsensitive)
}
- , highlighter: function (item) {
- var query = this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&')
- return item.replace(new RegExp('(' + query + ')', 'ig'), function ($1, match) {
- return '<strong>' + match + '</strong>'
- })
- }
-
, render: function (final_items, matching_items) {
var that = this
@@ -647,18 +640,4 @@ import {get_string_diff} from "../../src/util";
}
$.fn.typeahead.Constructor = Typeahead
-
-
- /* TYPEAHEAD DATA-API
- * ================== */
-
- $(function () {
- $('body').on('focus.typeahead.data-api', '[data-provide="typeahead"]', function (e) {
- var $this = $(this)
- if ($this.data('typeahead')) return
- e.preventDefault()
- $this.typeahead($this.data())
- })
- })
-
}(window.jQuery);