Changeset 23230


Ignore:
Timestamp:
06/15/13 15:54:26 (6 years ago)
Author:
mistic100
Message:

Merged revision(s) 23229 from trunk:
bug:2921 Can't create tags with special chars like ( + [
https://github.com/MartinKoerner/jquery-tokeninput/commit/cc8eab541ad1371c6f0c6730c0154908eb105f5d

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.5/themes/default/js/plugins/jquery.tokeninput.js

    r11008 r23230  
    577577    // Highlight the query part of the search term 
    578578    function highlight_term(value, term) { 
    579         return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<b>$1</b>"); 
     579        return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + escape_regexp_chars(term) + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<b>$1</b>"); 
     580    } 
     581     
     582    function escape_regexp_chars(string) { 
     583        var specials = new RegExp("[.*+?|()\\[\\]{}\\\\]", "g"); // .*+?|()[]{}\ 
     584        return string.replace(specials, "\\$&"); 
    580585    } 
    581586 
Note: See TracChangeset for help on using the changeset viewer.