* Requires Node.js 4.0+ to run.
+[3.4.7 / 2015-xx-xx](https://github.com/jakubpawlowicz/clean-css/compare/v3.4.6...3.4)
+==================
+
+* Fixed issue [#695](https://github.com/jakubpawlowicz/clean-css/issues/695) - shorthand overriding edge case.
+
[3.4.6 / 2015-10-14](https://github.com/jakubpawlowicz/clean-css/compare/v3.4.5...v3.4.6)
==================
return count > 1;
}
-function mergingIntoFunction(left, right, validator) {
- for (var i = 0, l = left.components.length; i < l; i++) {
- if (anyValue(validator.isValidFunction, left.components[i]))
+function overridingFunction(shorthand, validator) {
+ for (var i = 0, l = shorthand.components.length; i < l; i++) {
+ if (anyValue(validator.isValidFunction, shorthand.components[i]))
return true;
}
if (!sameVendorPrefixesIn([left], right.components))
continue;
+ if (!anyValue(validator.isValidFunction, left) && overridingFunction(right, validator))
+ continue;
+
component = right.components.filter(nameMatchFilter(left))[0];
mayOverride = (compactable[left.name] && compactable[left.name].canOverride) || canOverride.sameValue;
if (everyCombination(mayOverride, left, component, validator)) {
if (moreSameShorthands(properties, i - 1, left.name))
continue;
- if (mergingIntoFunction(left, right, validator))
+ if (overridingFunction(left, validator))
continue;
component = left.components.filter(nameMatchFilter(right))[0];
]);
}
},
+ 'longhand then shorthand - with unprefixed function 123': {
+ 'topic': 'p{background-color:red;background:linear-gradient(red,blue)}',
+ 'into': function (topic) {
+ assert.deepEqual(_optimize(topic), [
+ [['background-color'], ['red']],
+ [['background'], ['linear-gradient(red,blue)']]
+ ]);
+ }
+ },
'shorthand then longhand': {
'topic': 'p{background:__ESCAPED_URL_CLEAN_CSS0__ repeat;background-repeat:no-repeat}',
'into': function (topic) {