[Bug 2600] HTML tags in titles not escaped in list of returned items
http://bugs.koha.org/cgi-bin/bugzilla3/show_bug.cgi?id=2600 Joe Atzberger <joe.atzberger@liblime.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |joe.atzberger@liblime.com --- Comment #6 from Joe Atzberger <joe.atzberger@liblime.com> 2009-05-20 16:29:33 --- I recommend search term highlighting be moved to an entirely jquery-based model, so that we can maintain consistent expectations about HTML escaping of TMPL_VAR's. And of course this has already been done by others. Examples: http://weblogtoolscollection.com/archives/2009/04/10/how-to-highlight-search... http://devthought.com/blog/client-side/2009/04/javascript-regexp-based-highl... So basically: jQuery.fn.extend({ highlight: function(search, insensitive, klass){ var regex = new RegExp('(<[^>]*>)|(\\b'+ search.replace(/([-.*+?^${}()|[\]\/\\])/g,"\\$1") +')', insensitive ? 'ig' : 'g'); return this.html(this.html().replace(regex, function(a, b, c){ return (a.charAt(0) == '<') ? a : '<strong class="'+ klass +'">' + c + '</strong>'; })); } }); -- Configure bugmail: http://bugs.koha.org/cgi-bin/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
participants (1)
-
bugzilla-daemon@liblime.com