www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit d707947450a05ef7979031c8f9628c281dcb57da
parent edd4fabf2e48a294db9973b564b3008ade962979
Author: Avram Lyon <ajlyon@gmail.com>
Date:   Thu,  3 Nov 2011 11:53:53 -0700

Short-circuit removeDiacritics on alphanumeric and other basic input

Diffstat:
Mchrome/content/zotero/xpcom/utilities.js | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/chrome/content/zotero/xpcom/utilities.js b/chrome/content/zotero/xpcom/utilities.js @@ -671,6 +671,9 @@ Zotero.Utilities = { * From http://lehelk.com/2011/05/06/script-to-remove-diacritics/ */ "removeDiacritics": function (str, lowercaseOnly) { + // Short-circuit on the most basic input + if (/^[a-zA-Z0-9_-]*$/.test(str)) return str; + var map = this._diacriticsRemovalMap.lowercase; for (var i=0, len=map.length; i<len; i++) { str = str.replace(map[i].letters, map[i].base); @@ -1296,4 +1299,4 @@ Zotero.Utilities = { //this._cache[item.id] = cslItem; return cslItem; } -} -\ No newline at end of file +}