Title: [176699] trunk/Source/WebInspectorUI
Revision
176699
Author
[email protected]
Date
2014-12-02 16:39:34 -0800 (Tue, 02 Dec 2014)

Log Message

Web Inspector: CSS Minification breaks some selectors with colons
https://bugs.webkit.org/show_bug.cgi?id=139206

Patch by Joseph Pecoraro <[email protected]> on 2014-12-02
Reviewed by Simon Fraser.

Do not remove spaces preceeding colons, as they may change the semantics
of selectors with colon prefixes (e.g. "a :not(b)").

At the same time, we can strip spaces around "!" characters, for example
a space is not required before "!important" priority.

* Scripts/cssmin.py:
(cssminify):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (176698 => 176699)


--- trunk/Source/WebInspectorUI/ChangeLog	2014-12-03 00:33:29 UTC (rev 176698)
+++ trunk/Source/WebInspectorUI/ChangeLog	2014-12-03 00:39:34 UTC (rev 176699)
@@ -1,3 +1,19 @@
+2014-12-02  Joseph Pecoraro  <[email protected]>
+
+        Web Inspector: CSS Minification breaks some selectors with colons
+        https://bugs.webkit.org/show_bug.cgi?id=139206
+
+        Reviewed by Simon Fraser.
+
+        Do not remove spaces preceeding colons, as they may change the semantics
+        of selectors with colon prefixes (e.g. "a :not(b)").
+
+        At the same time, we can strip spaces around "!" characters, for example
+        a space is not required before "!important" priority.
+
+        * Scripts/cssmin.py:
+        (cssminify):
+
 2014-12-01  Benjamin Poulain  <[email protected]>
 
         Web Inspector: add more :not() and :matches() awesomeness

Modified: trunk/Source/WebInspectorUI/Scripts/cssmin.py (176698 => 176699)


--- trunk/Source/WebInspectorUI/Scripts/cssmin.py	2014-12-03 00:33:29 UTC (rev 176698)
+++ trunk/Source/WebInspectorUI/Scripts/cssmin.py	2014-12-03 00:39:34 UTC (rev 176699)
@@ -30,7 +30,8 @@
         (r"\/\*.*?\*\/", ""),          # delete comments
         (r"\n", ""),                   # delete new lines
         (r"\s+", " "),                 # change multiple spaces to one space
-        (r"\s?([;:{},~>])\s?", r"\1"), # delete space where it is not needed
+        (r"\s?([;{},~>!])\s?", r"\1"), # delete space where it is not needed
+        (r":\s", ":"),                 # delete spaces after colons, but not before. E.g. do not break selectors "a :focus", "b :matches(...)", "c :not(...)" where the leading space is significant
         (r"\s?([-+])(?:\s(?![0-9(]))", r"\1"), # delete whitespace around + and - when not followed by a number or paren. E.g. strip for selector "a + b" but not "calc(a + b)" which requires spaces.
         (r";}", "}")                   # change ';}' to '}' because the semicolon is not needed
     )
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to