diff --git a/bitbake/lib/toaster/toastergui/static/js/libtoaster.js b/bitbake/lib/toaster/toastergui/static/js/libtoaster.js index 34a3fbb1fb..c04f7aba2b 100644 --- a/bitbake/lib/toaster/toastergui/static/js/libtoaster.js +++ b/bitbake/lib/toaster/toastergui/static/js/libtoaster.js @@ -56,10 +56,14 @@ var libtoaster = (function (){ return 1; }, highlighter: function (item) { - if (item.hasOwnProperty('detail')) - /* Use jquery to escape the value as text into a span */ - return $('').text(item.name+' '+item.detail).get(0); - return $('').text(item.name).get(0); + /* Use jquery to escape the item name and detail */ + var current = $("").text(item.name + ' '+item.detail); + current = current.html(); + + var query = this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&') + return current.replace(new RegExp('(' + query + ')', 'ig'), function ($1, match) { + return '' + match + '' + }) }, sorter: function (items) { return items; }, xhrUrl: xhrUrl,