clean-css
Advanced tools
Comparing version 4.0.9 to 4.0.10
@@ -393,3 +393,3 @@ var shortenHex = require('./shorten-hex'); | ||
function removeQuotes(name, value) { | ||
if (name == 'content' || name.indexOf('font-feature-settings') > -1) { | ||
if (name == 'content' || name.indexOf('font-feature-settings') > -1 || name.indexOf('grid-') > -1) { | ||
return value; | ||
@@ -449,5 +449,5 @@ } | ||
if (property.hack && ( | ||
(property.hack == Hack.ASTERISK || property.hack == Hack.UNDERSCORE) && !options.compatibility.properties.iePrefixHack || | ||
property.hack == Hack.BACKSLASH && !options.compatibility.properties.ieSuffixHack || | ||
property.hack == Hack.BANG && !options.compatibility.properties.ieBangHack)) { | ||
(property.hack[0] == Hack.ASTERISK || property.hack[0] == Hack.UNDERSCORE) && !options.compatibility.properties.iePrefixHack || | ||
property.hack[0] == Hack.BACKSLASH && !options.compatibility.properties.ieSuffixHack || | ||
property.hack[0] == Hack.BANG && !options.compatibility.properties.ieBangHack)) { | ||
property.unused = true; | ||
@@ -454,0 +454,0 @@ } |
@@ -22,2 +22,3 @@ var isMergeable = require('./is-mergeable'); | ||
var mergeablePseudoElements = options.compatibility.selectors.mergeablePseudoElements; | ||
var mergeLimit = 8191; | ||
@@ -38,3 +39,4 @@ for (var i = 0, l = tokens.length; i < l; i++) { | ||
isMergeable(serializeRules(token[1]), mergeablePseudoClasses, mergeablePseudoElements) && | ||
isMergeable(serializeRules(lastToken[1]), mergeablePseudoClasses, mergeablePseudoElements)) { | ||
isMergeable(serializeRules(lastToken[1]), mergeablePseudoClasses, mergeablePseudoElements) && | ||
lastToken[1].length < mergeLimit) { | ||
lastToken[1] = tidyRules(lastToken[1].concat(token[1]), false, adjacentSpace, false, context.warnings); | ||
@@ -41,0 +43,0 @@ lastToken[1] = lastToken.length > 1 ? sortSelectors(lastToken[1], selectorsSortingMethod) : lastToken[1]; |
@@ -254,5 +254,8 @@ var hasInherit = require('./has-inherit'); | ||
if (left.important == right.important && left.hack != right.hack) | ||
if (left.important == right.important && left.hack[0] != right.hack[0]) | ||
continue; | ||
if (left.important == right.important && (left.hack[0] != right.hack[0] || (left.hack[1] && left.hack[1] != right.hack[1]))) | ||
continue; | ||
if (hasInherit(right)) | ||
@@ -259,0 +262,0 @@ continue; |
@@ -28,2 +28,3 @@ var canReorderSingle = require('./reorderable').canReorderSingle; | ||
var mergeablePseudoElements = options.compatibility.selectors.mergeablePseudoElements; | ||
var mergeLimit = 8191; | ||
var specificityCache = context.cache.specificity; | ||
@@ -130,3 +131,3 @@ var movableTokens = {}; | ||
function fitSorter(fit1, fit2) { | ||
return fit1[1] > fit2[1]; | ||
return fit1[1] > fit2[1] ? 1 : (fit1[1] == fit2[1] ? 0 : -1); | ||
} | ||
@@ -328,3 +329,4 @@ | ||
if (movedToBeDropped.indexOf(k) == -1 && !canReorderSingle(property, movedProperty, specificityCache) && !boundToAnotherPropertyInCurrrentToken(property, movedProperty, token)) { | ||
if (movedToBeDropped.indexOf(k) == -1 && (!canReorderSingle(property, movedProperty, specificityCache) && !boundToAnotherPropertyInCurrrentToken(property, movedProperty, token) || | ||
movableTokens[movedProperty[4]] && movableTokens[movedProperty[4]].length === mergeLimit)) { | ||
dropPropertiesAt(i + 1, movedProperty, token); | ||
@@ -351,5 +353,13 @@ | ||
var key = property[4]; | ||
movableTokens[key] = movableTokens[key] || []; | ||
movableTokens[key].push(token); | ||
if (movedSameProperty && movedProperties[samePropertyAt][5].length + property[5].length > mergeLimit) { | ||
dropPropertiesAt(i + 1, movedProperties[samePropertyAt]); | ||
movedProperties.splice(samePropertyAt, 1); | ||
movableTokens[key] = [token]; | ||
movedSameProperty = false; | ||
} else { | ||
movableTokens[key] = movableTokens[key] || []; | ||
movableTokens[key].push(token); | ||
} | ||
if (movedSameProperty) { | ||
@@ -356,0 +366,0 @@ movedProperties[samePropertyAt] = cloneAndMergeSelectors(movedProperties[samePropertyAt], property); |
@@ -6,3 +6,3 @@ var Hack = require('./hack'); | ||
var ASTERISK_HACK = '*'; | ||
var BACKSLASH_HACK = '\\9'; | ||
var BACKSLASH_HACK = '\\'; | ||
var IMPORTANT_TOKEN = '!important'; | ||
@@ -59,9 +59,9 @@ var UNDERSCORE_HACK = '_'; | ||
function restoreHack(property) { | ||
if (property.hack == Hack.UNDERSCORE) { | ||
if (property.hack[0] == Hack.UNDERSCORE) { | ||
property.name = UNDERSCORE_HACK + property.name; | ||
} else if (property.hack == Hack.ASTERISK) { | ||
} else if (property.hack[0] == Hack.ASTERISK) { | ||
property.name = ASTERISK_HACK + property.name; | ||
} else if (property.hack == Hack.BACKSLASH) { | ||
property.value[property.value.length - 1][1] += BACKSLASH_HACK; | ||
} else if (property.hack == Hack.BANG) { | ||
} else if (property.hack[0] == Hack.BACKSLASH) { | ||
property.value[property.value.length - 1][1] += BACKSLASH_HACK + property.hack[1]; | ||
} else if (property.hack[0] == Hack.BANG) { | ||
property.value[property.value.length - 1][1] += Marker.SPACE + BANG_HACK; | ||
@@ -68,0 +68,0 @@ } |
@@ -85,4 +85,4 @@ var Hack = require('./hack'); | ||
function hackType(property) { | ||
var type = false; | ||
function hackFrom(property) { | ||
var match = false; | ||
var name = property[1][1]; | ||
@@ -92,16 +92,16 @@ var lastValue = property[property.length - 1]; | ||
if (name[0] == Match.UNDERSCORE) { | ||
type = Hack.UNDERSCORE; | ||
match = [Hack.UNDERSCORE]; | ||
} else if (name[0] == Match.ASTERISK) { | ||
type = Hack.ASTERISK; | ||
match = [Hack.ASTERISK]; | ||
} else if (lastValue[1][0] == Match.BANG && !lastValue[1].match(Match.IMPORTANT_WORD_PATTERN)) { | ||
type = Hack.BANG; | ||
match = [Hack.BANG]; | ||
} else if (lastValue[1].indexOf(Match.BANG) > 0 && !lastValue[1].match(Match.IMPORTANT_WORD_PATTERN) && Match.BANG_SUFFIX_PATTERN.test(lastValue[1])) { | ||
type = Hack.BANG; | ||
match = [Hack.BANG]; | ||
} else if (lastValue[1].indexOf(Match.BACKSLASH) > 0 && lastValue[1].indexOf(Match.BACKSLASH) == lastValue[1].length - Match.BACKSLASH.length - 1) { | ||
type = Hack.BACKSLASH; | ||
match = [Hack.BACKSLASH, lastValue[1].substring(lastValue[1].indexOf(Match.BACKSLASH) + 1)]; | ||
} else if (lastValue[1].indexOf(Match.BACKSLASH) === 0 && lastValue[1].length == 2) { | ||
type = Hack.BACKSLASH; | ||
match = [Hack.BACKSLASH, lastValue[1].substring(1)]; | ||
} | ||
return type; | ||
return match; | ||
} | ||
@@ -147,6 +147,6 @@ | ||
function stripSuffixHack(property, hackType) { | ||
function stripSuffixHack(property, hackFrom) { | ||
var lastValue = property[property.length - 1]; | ||
lastValue[1] = lastValue[1] | ||
.substring(0, lastValue[1].indexOf(hackType == Hack.BACKSLASH ? Match.BACKSLASH : Match.BANG)) | ||
.substring(0, lastValue[1].indexOf(hackFrom[0] == Hack.BACKSLASH ? Match.BACKSLASH : Match.BANG)) | ||
.trim(); | ||
@@ -165,7 +165,7 @@ | ||
var hackProperty = hackType(property); | ||
if (hackProperty == Hack.ASTERISK || hackProperty == Hack.UNDERSCORE) { | ||
var whichHack = hackFrom(property); | ||
if (whichHack[0] == Hack.ASTERISK || whichHack[0] == Hack.UNDERSCORE) { | ||
stripPrefixHack(property); | ||
} else if (hackProperty == Hack.BACKSLASH || hackProperty == Hack.BANG) { | ||
stripSuffixHack(property, hackProperty); | ||
} else if (whichHack[0] == Hack.BACKSLASH || whichHack[0] == Hack.BANG) { | ||
stripSuffixHack(property, whichHack); | ||
} | ||
@@ -177,3 +177,3 @@ | ||
dirty: false, | ||
hack: hackProperty, | ||
hack: whichHack, | ||
important: importantProperty, | ||
@@ -180,0 +180,0 @@ name: property[1][1], |
{ | ||
"name": "clean-css", | ||
"version": "4.0.9", | ||
"version": "4.0.10", | ||
"author": "Jakub Pawlowicz <contact@jakubpawlowicz.com> (http://twitter.com/jakubpawlowicz)", | ||
@@ -5,0 +5,0 @@ "description": "A well-tested CSS minifier", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
373955
7809