Changeset 176699 in webkit


Ignore:
Timestamp:
Dec 2, 2014 4:39:34 PM (9 years ago)
Author:
commit-queue@webkit.org
Message:

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

Patch by Joseph Pecoraro <Joseph Pecoraro> 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):

Location:
trunk/Source/WebInspectorUI
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r176610 r176699  
     12014-12-02  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        Web Inspector: CSS Minification breaks some selectors with colons
     4        https://bugs.webkit.org/show_bug.cgi?id=139206
     5
     6        Reviewed by Simon Fraser.
     7
     8        Do not remove spaces preceeding colons, as they may change the semantics
     9        of selectors with colon prefixes (e.g. "a :not(b)").
     10
     11        At the same time, we can strip spaces around "!" characters, for example
     12        a space is not required before "!important" priority.
     13
     14        * Scripts/cssmin.py:
     15        (cssminify):
     16
    1172014-12-01  Benjamin Poulain  <benjamin@webkit.org>
    218
  • trunk/Source/WebInspectorUI/Scripts/cssmin.py

    r174615 r176699  
    3131        (r"\n", ""),                   # delete new lines
    3232        (r"\s+", " "),                 # change multiple spaces to one space
    33         (r"\s?([;:{},~>])\s?", r"\1"), # delete space where it is not needed
     33        (r"\s?([;{},~>!])\s?", r"\1"), # delete space where it is not needed
     34        (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
    3435        (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.
    3536        (r";}", "}")                   # change ';}' to '}' because the semicolon is not needed
Note: See TracChangeset for help on using the changeset viewer.