From: Jakub Pawlowicz Date: Tue, 27 Dec 2016 15:51:40 +0000 (+0100) Subject: Simplifies compatibility mode definitions. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=221660e60de4435483f934d86fc42272e7458e23;p=clean-css.git Simplifies compatibility mode definitions. Why: * Using inheritance it's clear which properties change. --- diff --git a/lib/utils/compatibility.js b/lib/utils/compatibility.js index d343a989..7e37cd94 100644 --- a/lib/utils/compatibility.js +++ b/lib/utils/compatibility.js @@ -37,82 +37,40 @@ var DEFAULTS = { vmin: true, vw: true } + } +}; + +DEFAULTS.ie8 = merge(DEFAULTS['*'], { + colors: { + opacity: false }, - 'ie8': { - colors: { - opacity: false - }, - properties: { - backgroundClipMerging: false, - backgroundOriginMerging: false, - backgroundSizeMerging: false, - colors: true, - fontWeight: true, - ieBangHack: false, - iePrefixHack: true, - ieSuffixHack: true, - merging: false, - shorterLengthUnits: false, - spaceAfterClosingBrace: true, - urlQuotes: false, - zeroUnits: true - }, - selectors: { - adjacentSpace: false, - ie7Hack: false, - special: /(\-moz\-|\-ms\-|\-o\-|\-webkit\-|:root|:nth|:first\-of|:last|:only|:empty|:target|:checked|::selection|:enabled|:disabled|:not|:placeholder|:host|::content|\/deep\/|::shadow|^,)/ - }, - units: { - ch: false, - in: true, - pc: true, - pt: true, - rem: false, - vh: false, - vm: false, - vmax: false, - vmin: false, - vw: false - } + properties: { + iePrefixHack: true, + merging: false }, - 'ie7': { - colors: { - opacity: false - }, - properties: { - backgroundClipMerging: false, - backgroundOriginMerging: false, - backgroundSizeMerging: false, - colors: true, - fontWeight: true, - ieBangHack: true, - iePrefixHack: true, - ieSuffixHack: true, - merging: false, - shorterLengthUnits: false, - spaceAfterClosingBrace: true, - urlQuotes: false, - zeroUnits: true - }, - selectors: { - adjacentSpace: false, - ie7Hack: true, - special: /(\-moz\-|\-ms\-|\-o\-|\-webkit\-|:focus|:before|:after|:root|:nth|:first\-of|:last|:only|:empty|:target|:checked|::selection|:enabled|:disabled|:not|:placeholder|:host|::content|\/deep\/|::shadow|^,)/ - }, - units: { - ch: false, - in: true, - pc: true, - pt: true, - rem: false, - vh: false, - vm: false, - vmax: false, - vmin: false, - vw: false, - } + selectors: { + special: /(\-moz\-|\-ms\-|\-o\-|\-webkit\-|:root|:nth|:first\-of|:last|:only|:empty|:target|:checked|::selection|:enabled|:disabled|:not|:placeholder|:host|::content|\/deep\/|::shadow|^,)/ + }, + units: { + ch: false, + rem: false, + vh: false, + vm: false, + vmax: false, + vmin: false, + vw: false } -}; +}); + +DEFAULTS.ie7 = merge(DEFAULTS.ie8, { + properties: { + ieBangHack: true + }, + selectors: { + ie7Hack: true, + special: /(\-moz\-|\-ms\-|\-o\-|\-webkit\-|:focus|:before|:after|:root|:nth|:first\-of|:last|:only|:empty|:target|:checked|::selection|:enabled|:disabled|:not|:placeholder|:host|::content|\/deep\/|::shadow|^,)/ + }, +}); function compatibility(source) { return merge(DEFAULTS['*'], calculateSource(source));