mirror of
https://github.com/mrclay/minify.git
synced 2025-08-08 07:06:49 +02:00
CSS/Compressor.php : Issue 107 fix
This commit is contained in:
@@ -176,6 +176,7 @@ class Minify_CSS_Compressor {
|
||||
*/
|
||||
protected function _commentCB($m)
|
||||
{
|
||||
$hasSurroundingWs = (trim($m[0]) !== $m[1]);
|
||||
$m = $m[1];
|
||||
// $m is the comment content w/o the surrounding tokens,
|
||||
// but the return value will replace the entire comment.
|
||||
@@ -219,7 +220,11 @@ class Minify_CSS_Compressor {
|
||||
$this->_inHack = false;
|
||||
return '/**/';
|
||||
}
|
||||
return ''; // remove all other comments
|
||||
// Issue 107: if there's any surrounding whitespace, it may be important, so
|
||||
// replace the comment with a single space
|
||||
return $hasSurroundingWs // remove all other comments
|
||||
? ' '
|
||||
: '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -4,3 +4,6 @@
|
||||
/*! YUI Compressor style comments are preserved */
|
||||
|
||||
/* but all other comments are removed */
|
||||
|
||||
/* comments that have any surrounding whitespace are replaced by a single space. */
|
||||
body{ background:#fff/*eef*/ url(/path/to/image.gif) repeat-y; }
|
||||
|
@@ -1,2 +1,3 @@
|
||||
|
||||
/* YUI Compressor style comments are preserved */
|
||||
body{background:#fff url(/path/to/image.gif) repeat-y}
|
4
min_unit_tests/_test_files/css/hacks.min.css
vendored
4
min_unit_tests/_test_files/css/hacks.min.css
vendored
@@ -1,4 +1,4 @@
|
||||
/*\*/a{}.foo{color:red}/**//*\*//*/@import "ie5mac.css";/**//*/*/.foo{display:block}/**//*/*//*/.foo{display:crazy}/**/div{width:140px;width/**/:/**/100px;width:/**/100px}html>/**/body{}div{width:400px;voice-family:"\"}\"";voice-family:inherit;width:300px}div{filter:chroma(color=#aabbcc);filter:mask(color=#000000) shadow(color=#9BAD71, direction=135) chroma(color=#000000)}@media
|
||||
/*\*/a{}.foo{color:red}/**/ /*\*//*/@import "ie5mac.css";/**/ /*/*/.foo{display:block}/**/ /*/*//*/.foo{display:crazy}/**/ div{width:140px;width/**/:/**/100px;width:/**/100px}html>/**/body{}div{width:400px;voice-family:"\"}\"";voice-family:inherit;width:300px}div{filter:chroma(color=#aabbcc);filter:mask(color=#000000) shadow(color=#9BAD71, direction=135) chroma(color=#000000)}@media
|
||||
screen{/*\*/* html
|
||||
div#page{height:1%}/**/}foo{_height:20px;*height:15px}@media
|
||||
tty{i{content:"\";/*" "*/}}@import 'midpassafter.css';/*"}}/* */p:first-letter {color:red}p:first-line {color:red}
|
||||
tty{i{content:"\";/*" "*/}}@import 'midpassafter.css';/*"}}/* */ p:first-letter {color:red}p:first-line {color:red}
|
@@ -10,7 +10,7 @@ if(is.ua.indexOf('gecko')>=0){is.ie=is.ns=false;is.gecko=true;}</script> <script
|
||||
{}/*]]>*/</script> <script type="text/javascript">i=1;</script> <script type="text/javascript">/*<![CDATA[*/(i<1);/*]]>*/</script> <!--[if IE 6]><style type="text/css">/*<![CDATA[*/
|
||||
/* copyright: you'll need CDATA for this < & */
|
||||
body{background:white}/*]]>*/</style><![endif]--><style type="text/css" title="currentStyle" media="screen">@import "/001/001.css";/*\*/css
|
||||
hack{}/**//*/*/css
|
||||
hack{}/**/ /*/*/css
|
||||
hack{}/**/css
|
||||
hack{display/**/:/**/none;display:none}</style><link
|
||||
rel="Shortcut Icon"
|
||||
|
@@ -10,7 +10,7 @@ if(is.ua.indexOf('gecko')>=0){is.ie=is.ns=false;is.gecko=true;}</script> <script
|
||||
{}</script> <script type="text/javascript">i=1;</script> <script type="text/javascript">(i<1);</script> <!--[if IE 6]><style type="text/css">
|
||||
/* copyright: you'll need CDATA for this < & */
|
||||
body{background:white}</style><![endif]--><style type="text/css" title="currentStyle" media="screen">@import "/001/001.css";/*\*/css
|
||||
hack{}/**//*/*/css
|
||||
hack{}/**/ /*/*/css
|
||||
hack{}/**/css
|
||||
hack{display/**/:/**/none;display:none}</style><link
|
||||
rel="Shortcut Icon"
|
||||
|
@@ -2,3 +2,4 @@
|
||||
solid #0f7}div#content
|
||||
h1+p{padding-top:0;margin-top:0}@media all and (min-width: 640px){#media-queries-1{background-color:#0f0}}@media screen and (max-width: 2000px){#media-queries-2{background-color:#0f0}}
|
||||
/* YUI Compressor style comments are preserved */
|
||||
body{background:#fff url(/path/to/image.gif) repeat-y}
|
Reference in New Issue
Block a user