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:
Francis Lachapelle
2009-05-21 15:37:00 +00:00
parent 791400e729
commit b338b36963
@@ -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;
}