Commits

Andrew Demey committed 0116b43

Removing empty rules with a media query like "(-o-max-device-pixel-ratio: 5/4)" would stop at the "/".
Forward slash is replace with a token before the empty rule check. Replaced after empty rule check.

Comments (0)

Files changed (3)

src/com/yahoo/platform/yui/compressor/CssCompressor.java

         // shorter opacity IE filter
         css = css.replaceAll("(?i)progid:DXImageTransform.Microsoft.Alpha\\(Opacity=", "alpha(opacity=");
 
+        // Find a fraction that is used for Opera's -o-device-pixel-ratio query
+        // Add token to add the "\" back in later
+        css = css.replaceAll("\\(([\\-A-Za-z]+):([0-9]+)\\/([0-9]+)\\)", "($1:$2___YUI_QUERY_FRACTION___$3)");
+
         // Remove empty rules.
         css = css.replaceAll("[^\\}\\{/;]+\\{\\}", "");
 
+        // Add "\" back to fix Opera -o-device-pixel-ratio query
+        css = css.replaceAll("___YUI_QUERY_FRACTION___", "/");
+
         // TODO: Should this be after we re-insert tokens. These could alter the break points. However then
         // we'd need to make sure we don't break in the middle of a string etc.
         if (linebreakpos >= 0) {

tests/opera-pixel-ratio.css

+@media
+	(-o-min-device-pixel-ratio:10/4),
+	(-o-max-device-pixel-ratio:  5/4),
+	(-o-device-pixel-ratio:  1/1),
+  (-o-device-pixel-ratio:  1/10),
+	(-o-device-pixel-ratio:  1.25),
+	(device-pixel-ratio:1.5)  {  
+		/* some:prop; */
+		/* An empty property with a fraction in query would break previously */
+ }
+ 
+ .something {
+	 foo: bar;
+ }

tests/opera-pixel-ratio.css.min

+.something{foo:bar}