mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-07-06 00:45:09 +00:00
Fix regexp to be global in special characters replacement
Monotone-Parent: 3968c9c94e7ed1c0fce35b47f2c77ec9d2739a6a Monotone-Revision: 8d83618a18c319c1db3843f81574c79ee5d52430 Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2009-05-21T15:37:00 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -60,17 +60,20 @@ String.prototype.asDate = function () {
|
||||
|
||||
String.prototype.asCSSIdentifier = function () {
|
||||
var substitutions = { '_': '_U_',
|
||||
'.': '_D_',
|
||||
'\\.': '_D_',
|
||||
'#': '_H_',
|
||||
'@': '_A_',
|
||||
'*': '_S_',
|
||||
'\\*': '_S_',
|
||||
':': '_C_',
|
||||
',': '_CO_',
|
||||
' ': '_SP_' };
|
||||
var newString = this;
|
||||
var re;
|
||||
|
||||
for (var key in substitutions)
|
||||
newString = newString.replace(key, substitutions[key]);
|
||||
for (var key in substitutions) {
|
||||
re = new RegExp(key, 'g');
|
||||
newString = newString.replace(re, substitutions[key]);
|
||||
}
|
||||
|
||||
return newString;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user