Revert "Revert "Improve creation of CSS identifier""

This reverts commit 7d018221ef.
pull/89/head
Ludovic Marcotte 2015-06-10 20:05:40 -04:00
parent 85ad849189
commit d9896192f3
2 changed files with 15 additions and 7 deletions

View File

@ -333,12 +333,18 @@ static int cssEscapingCount;
int count;
strings = [NSArray arrayWithObjects: @"_U_", @"_D_", @"_H_", @"_A_", @"_S_",
@"_C_", @"_CO_", @"_SP_", @"_SQ_", @"_AM_", @"_P_", @"_DS_", nil];
@"_C_", @"_SC_",
@"_CO_", @"_SP_", @"_SQ_", @"_DQ_",
@"_LP_", @"_RP_", @"_LS_", @"_RS_", @"_LC_", @"_RC_",
@"_AM_", @"_P_", @"_DS_", nil];
[strings retain];
cssEscapingStrings = [strings asPointersOfObjects];
characters = [NSArray arrayWithObjects: @"_", @".", @"#", @"@", @"*", @":",
@",", @" ", @"'", @"&", @"+", @"$", nil];
characters = [NSArray arrayWithObjects: @"_", @".", @"#", @"@", @"*",
@":", @";",
@",", @" ", @"'", @"\"",
@"(", @")", @"[", @"]", @"{", @"}",
@"&", @"+", @"$", nil];
cssEscapingCount = [strings count];
cssEscapingCharacters = NSZoneMalloc (NULL,
(cssEscapingCount + 1)

View File

@ -95,10 +95,12 @@ String.prototype.asDate = function () {
};
String.prototype.asCSSIdentifier = function() {
var characters = [ '_' , '\\.', '#' , '@' , '\\*', ':' , ',' , ' '
, "'", '&', '\\+' ];
var escapeds = [ '_U_', '_D_', '_H_', '_A_', '_S_', '_C_', '_CO_',
'_SP_', '_SQ_', '_AM_', '_P_' ];
var characters = [ '_' , '\\.', '#' , '@' , '\\*', ':' , ';' , ',' , ' ',
'\\(', '\\)', '\\[', '\\]', '\\{', '\\}',
, "'", '"', '&', '\\+' ];
var escapeds = [ '_U_', '_D_', '_H_', '_A_', '_S_', '_C_', '_SC_', '_CO_', '_SP_',
'_LP_', '_RP_', '_LS_', '_RQ_', '_LC_', '_RC_',
'_SQ_', '_DQ_', '_AM_', '_P_' ];
var newString = this;
for (var i = 0; i < characters.length; i++) {