clean-css
Advanced tools
Comparing version 5.1.1 to 5.1.2
@@ -19,2 +19,14 @@ var Spaces = require('../../options/format').Spaces; | ||
var PSEUDO_CLASSES_WITH_SELECTORS = [ | ||
':current', | ||
':future', | ||
':has', | ||
':host', | ||
':host-context', | ||
':is', | ||
':not', | ||
':past', | ||
':where' | ||
]; | ||
function hasInvalidCharacters(value) { | ||
@@ -61,4 +73,5 @@ var isEscaped; | ||
var isWhitespace; | ||
var isPseudoClass = value[0] == Marker.COLON; | ||
var isSpaceAwarePseudoClass; | ||
var roundBracketLevel = 0; | ||
var wasComma = false; | ||
var wasRelation = false; | ||
@@ -78,2 +91,5 @@ var wasWhitespace = false; | ||
isWhitespace = WHITESPACE_PATTERN.test(character); | ||
isSpaceAwarePseudoClass = roundBracketLevel == 1 && character == Marker.CLOSE_ROUND_BRACKET ? | ||
false : | ||
isSpaceAwarePseudoClass || (roundBracketLevel === 0 && character == Marker.COLON && isPseudoClassWithSelectors(value, i)); | ||
@@ -118,3 +134,5 @@ if (wasEscaped && isQuoted && isNewLineWin) { | ||
stripped.push(character); | ||
} else if (isWhitespace && !wasWhitespace && roundBracketLevel > 0 && isPseudoClass) { | ||
} else if (isWhitespace && !wasWhitespace && wasComma && roundBracketLevel > 0 && isSpaceAwarePseudoClass) { | ||
// skip space | ||
} else if (isWhitespace && !wasWhitespace && roundBracketLevel > 0 && isSpaceAwarePseudoClass) { | ||
stripped.push(character); | ||
@@ -143,2 +161,3 @@ } else if (isWhitespace && (isAttribute || roundBracketLevel > 0) && !isQuoted) { | ||
wasWhitespace = isWhitespace; | ||
wasComma = character == Marker.COMMA; | ||
} | ||
@@ -151,2 +170,8 @@ | ||
function isPseudoClassWithSelectors(value, colonPosition) { | ||
var pseudoClass = value.substring(colonPosition, value.indexOf(Marker.OPEN_ROUND_BRACKET, colonPosition)); | ||
return PSEUDO_CLASSES_WITH_SELECTORS.indexOf(pseudoClass) > -1; | ||
} | ||
function removeQuotes(value) { | ||
@@ -153,0 +178,0 @@ if (value.indexOf('\'') == -1 && value.indexOf('"') == -1) { |
{ | ||
"name": "clean-css", | ||
"version": "5.1.1", | ||
"version": "5.1.2", | ||
"author": "Jakub Pawlowicz <contact@jakubpawlowicz.com> (https://jakubpawlowicz.com)", | ||
@@ -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
479914
10295