Skip to content

Commit

Permalink
Removed redundant A-F check in regex. We're already using the i flag.…
Browse files Browse the repository at this point in the history
… Reminded me to add case variance to the test file
  • Loading branch information
sdesai committed Sep 23, 2011
1 parent f023e8c commit cb68d77
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion ports/js/cssmin.js
Expand Up @@ -119,7 +119,7 @@ YAHOO.compressor._extractDataUrls = function (css, preservedTokens) {
YAHOO.compressor._compressHexColors = function(css) { YAHOO.compressor._compressHexColors = function(css) {


// Look for hex colors inside { ... } (to avoid IDs) and which don't have a =, or a " in front of them (to avoid filters) // Look for hex colors inside { ... } (to avoid IDs) and which don't have a =, or a " in front of them (to avoid filters)
var pattern = /([^"'=\s])(\s*)#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])(\}|[^0-9a-fA-F{][^{]*?\})/gi, var pattern = /([^"'=\s])(\s*)#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])(\}|[^0-9a-f{][^{]*?\})/gi,
m, m,
index = 0, index = 0,
sb = []; sb = [];
Expand Down
9 changes: 5 additions & 4 deletions tests/color.css
@@ -1,6 +1,6 @@
.color { .color {
me: rgb(123, 123, 123); me: rgb(123, 123, 123);
impressed: #ffeedd; impressed: #FfEedD;
again: #456789; again: #456789;
andagain:#aa66cc; andagain:#aa66cc;
background-color:#aa66ccc; background-color:#aa66ccc;
Expand All @@ -14,16 +14,17 @@
background-color:#ffee11; background-color:#ffee11;
filter: chroma(color="#FFFFFF"); filter: chroma(color="#FFFFFF");
color:#441122; color:#441122;
border-color:#aa66ccC
} }


.foo #AABBCC { .foo #AABBCC {
background-color:#ffee11; background-color:#fFEe11;
color:#441122; color:#441122;
filter: chroma(color="#FFFFFF") filter: chroma(color="#FFFFFF")
} }


.bar, #AABBCC { .bar, #AABBCC {
background-color:#ffee11; background-color:#FFee11;
color:#441122; color:#441122;
} }


Expand All @@ -34,7 +35,7 @@


@media screen { @media screen {
.bar, #AABBCC { .bar, #AABBCC {
background-color:#ffee11; background-color:#ffEE11;
color:#441122 color:#441122
} }
} }
Expand Down
2 changes: 1 addition & 1 deletion tests/color.css.min
@@ -1,3 +1,3 @@
.color{me:#7b7b7b;impressed:#fed;again:#456789;andagain:#a6c;background-color:#aa66ccc;filter:chroma(color="#FFFFFF");background:none repeat scroll 0 0 #f00;alpha:rgba(1,2,3,4);color:#12a}#AABBCC{background-color:#fe1;filter:chroma(color="#FFFFFF");color:#412}.foo #AABBCC{background-color:#fe1;color:#412;filter:chroma(color="#FFFFFF")}.bar,#AABBCC{background-color:#fe1;color:#412}.foo,#AABBCC.foobar{background-color:#fe1;color:#412}@media screen{.bar,#AABBCC{background-color:#fe1;color:#412}} .color{me:#7b7b7b;impressed:#fed;again:#456789;andagain:#a6c;background-color:#aa66ccc;filter:chroma(color="#FFFFFF");background:none repeat scroll 0 0 #f00;alpha:rgba(1,2,3,4);color:#12a}#AABBCC{background-color:#fe1;filter:chroma(color="#FFFFFF");color:#412;border-color:#aa66ccC}.foo #AABBCC{background-color:#fe1;color:#412;filter:chroma(color="#FFFFFF")}.bar,#AABBCC{background-color:#fe1;color:#412}.foo,#AABBCC.foobar{background-color:#fe1;color:#412}@media screen{.bar,#AABBCC{background-color:#fe1;color:#412}}




0 comments on commit cb68d77

Please sign in to comment.