clean-css
Advanced tools
Comparing version 4.1.9 to 4.1.10
@@ -302,2 +302,6 @@ var InvalidPropertyError = require('./invalid-property-error'); | ||
if (values.length < 2 || !_anyIsFontSize(values, validator) || !_anyIsFontFamily(values, validator)) { | ||
throw new InvalidPropertyError('Invalid font values at ' + formatPosition(property.all[property.position][1][2][0]) + '. Ignoring.'); | ||
} | ||
if (values.length > 1 && _anyIsInherit(values)) { | ||
@@ -381,2 +385,32 @@ throw new InvalidPropertyError('Invalid font values at ' + formatPosition(values[0][2][0]) + '. Ignoring.'); | ||
function _anyIsFontSize(values, validator) { | ||
var value; | ||
var i, l; | ||
for (i = 0, l = values.length; i < l; i++) { | ||
value = values[i]; | ||
if (validator.isFontSizeKeyword(value[1]) || validator.isUnit(value[1]) && !validator.isDynamicUnit(value[1]) || validator.isFunction(value[1])) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
function _anyIsFontFamily(values, validator) { | ||
var value; | ||
var i, l; | ||
for (i = 0, l = values.length; i < l; i++) { | ||
value = values[i]; | ||
if (validator.isIdentifier(value[1])) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
function fourValues(property, compactable) { | ||
@@ -383,0 +417,0 @@ var componentNames = compactable[property.name].components; |
@@ -102,2 +102,3 @@ // Contains the interpretation of CSS properties, as used by the property optimizer | ||
intoMultiplexMode: 'real', | ||
keepUnlessDefault: 'animation-delay', | ||
vendorPrefixes: [ | ||
@@ -959,2 +960,6 @@ '-moz-', | ||
if ('keepUnlessDefault' in clonedDescriptor) { | ||
clonedDescriptor.keepUnlessDefault = prefix + clonedDescriptor.keepUnlessDefault; | ||
} | ||
return clonedDescriptor; | ||
@@ -961,0 +966,0 @@ } |
@@ -11,6 +11,9 @@ var populateComponents = require('./properties/populate-components'); | ||
var keyframeRegex = /^@(\-moz\-|\-o\-|\-webkit\-)?keyframes /; | ||
var importantRegex = /\s*!important$/; | ||
var optionalMatchingQuotesRegex = /^(['"]?)(.*)\1$/; | ||
function removeQuotes(value) { | ||
return value.replace(optionalMatchingQuotesRegex, '$2'); | ||
function normalize(value) { | ||
return value | ||
.replace(optionalMatchingQuotesRegex, '$2') | ||
.replace(importantRegex, ''); | ||
} | ||
@@ -116,3 +119,3 @@ | ||
if (property[1][1] == 'font-family') { | ||
match = removeQuotes(property[2][1].toLowerCase()); | ||
match = normalize(property[2][1].toLowerCase()); | ||
atRules[match] = atRules[match] || []; | ||
@@ -144,3 +147,3 @@ atRules[match].push(token); | ||
for (j = 0, m = component.value.length; j < m; j++) { | ||
normalizedMatch = removeQuotes(component.value[j][1].toLowerCase()); | ||
normalizedMatch = normalize(component.value[j][1].toLowerCase()); | ||
@@ -157,3 +160,3 @@ if (normalizedMatch in atRules) { | ||
for (j = 2, m = property.length; j < m; j++) { | ||
normalizedMatch = removeQuotes(property[j][1].toLowerCase()); | ||
normalizedMatch = normalize(property[j][1].toLowerCase()); | ||
@@ -160,0 +163,0 @@ if (normalizedMatch in atRules) { |
@@ -267,4 +267,5 @@ var shallowClone = require('./clone').shallow; | ||
if (component.value[0][1] != descriptor.defaultValue) | ||
if (component.value[0][1] != descriptor.defaultValue || ('keepUnlessDefault' in descriptor) && !isDefault(components, compactable, descriptor.keepUnlessDefault)) { | ||
restored.unshift(component.value[0]); | ||
} | ||
} | ||
@@ -281,2 +282,17 @@ | ||
function isDefault(components, compactable, propertyName) { | ||
var component; | ||
var i, l; | ||
for (i = 0, l = components.length; i < l; i++) { | ||
component = components[i]; | ||
if (component.name == propertyName && component.value[0][1] == compactable[propertyName].defaultValue) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
module.exports = { | ||
@@ -283,0 +299,0 @@ background: background, |
@@ -37,2 +37,6 @@ var SourceMapConsumer = require('source-map').SourceMapConsumer; | ||
if (!originalPosition || originalPosition.column < 0) { | ||
return metadata; | ||
} | ||
if (originalPosition.line === null && line > 1 && selectorFallbacks > 0) { | ||
@@ -39,0 +43,0 @@ return originalPositionFor(maps, [line - 1, column, source], range, selectorFallbacks - 1); |
@@ -117,2 +117,3 @@ var Marker = require('./marker'); | ||
isCommentEnd = level == Level.COMMENT && isCommentEndMarker; | ||
roundBracketLevel = Math.max(roundBracketLevel, 0); | ||
@@ -119,0 +120,0 @@ metadata = buffer.length === 0 ? |
{ | ||
"name": "clean-css", | ||
"version": "4.1.9", | ||
"version": "4.1.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
422556
8918