mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-22 11:55:24 +00:00
Monotone-Parent: 584371c66b4989feaab5012db26f19d8ed7cd7ad
Monotone-Revision: 72a4f60ec4a14476e485da2ce400df860572fa48 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-01-05T22:34:35 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -59,21 +59,14 @@ String.prototype.asDate = function () {
|
||||
return newDate;
|
||||
};
|
||||
|
||||
String.prototype.asCSSIdentifier = function () {
|
||||
var substitutions = { '_': '_U_',
|
||||
'\\.': '_D_',
|
||||
'#': '_H_',
|
||||
'@': '_A_',
|
||||
'\\*': '_S_',
|
||||
':': '_C_',
|
||||
',': '_CO_',
|
||||
' ': '_SP_' };
|
||||
var newString = this;
|
||||
var re;
|
||||
String.prototype.asCSSIdentifier = function() {
|
||||
var characters = [ '_' , '\\.', '#' , '@' , '\\*', ':' , ',' , ' ' ];
|
||||
var escapeds = [ '_U_', '_D_', '_H_', '_A_', '_S_', '_C_', '_CO_', '_SP_' ];
|
||||
|
||||
for (var key in substitutions) {
|
||||
re = new RegExp(key, 'g');
|
||||
newString = newString.replace(re, substitutions[key]);
|
||||
var newString = this;
|
||||
for (var i = 0; i < characters.length; i++) {
|
||||
var re = new RegExp(characters[i], 'g');
|
||||
newString = newString.replace(re, escapeds[i]);
|
||||
}
|
||||
|
||||
return newString;
|
||||
|
||||
Reference in New Issue
Block a user