* Fixed issue [#446](https://github.com/jakubpawlowicz/clean-css/issues/446) - `list-style` fuzzy matching.
* Fixed issue [#468](https://github.com/jakubpawlowicz/clean-css/issues/468) - bumps `source-map` to 0.4.x.
* Fixed issue [#480](https://github.com/jakubpawlowicz/clean-css/issues/480) - extracting uppercase property names.
+* Fixed issue [#490](https://github.com/jakubpawlowicz/clean-css/issues/490) - vendor prefixed multivalue `background`.
* Fixed issue [#500](https://github.com/jakubpawlowicz/clean-css/issues/500) - merging duplicate adjacent properties.
[3.1.9 / 2015-04-04](https://github.com/jakubpawlowicz/clean-css/compare/v3.1.8...v3.1.9)
--- /dev/null
+var shallowClone = require('./clone').shallow;
+
+var MULTIPLEX_SEPARATOR = ',';
+
+function everyCombination(fn, left, right, validator) {
+ var _left = shallowClone(left);
+ var _right = shallowClone(right);
+
+ for (var i = 0, l = left.value.length; i < l; i++) {
+ for (var j = 0, m = right.value.length; j < m; j++) {
+ if (left.value[i][0] == MULTIPLEX_SEPARATOR || right.value[j][0] == MULTIPLEX_SEPARATOR)
+ continue;
+
+ _left.value = [left.value[i]];
+ _right.value = [right.value[j]];
+ if (!fn(_left, _right, validator))
+ return false;
+ }
+ }
+
+ return true;
+}
+
+module.exports = everyCombination;
var shallowClone = require('./clone').shallow;
var hasInherit = require('./has-inherit');
var restoreShorthands = require('./restore-shorthands');
+var everyCombination = require('./every-combination');
var stringifyProperty = require('../stringifier/one-time').property;
component = right.components.filter(nameMatchFilter(left))[0];
mayOverride = (compactable[left.name] && compactable[left.name].canOverride) || canOverride.sameValue;
- if (mayOverride(left, component, validator)) {
+ if (everyCombination(mayOverride, left, component, validator)) {
left.unused = true;
}
} else if (left.shorthand && !right.shorthand && isComponentOf(left, right)) {
continue;
component = left.components.filter(nameMatchFilter(right))[0];
- if (mayOverride(component, right, validator)) {
+ if (everyCombination(mayOverride, component, right, validator)) {
var disabledBackgroundSizeMerging = !compatibility.properties.backgroundSizeMerging && component.name.indexOf('background-size') > -1;
var nonMergeableValue = compactable[right.name].nonMergeableValue === right.value[0][0];
var rightComponent = right.components[k];
mayOverride = compactable[leftComponent.name].canOverride || canOverride.sameValue;
- if (!mayOverride(leftComponent, rightComponent, validator))
+ if (!everyCombination(mayOverride, leftComponent, rightComponent, validator))
continue propertyLoop;
- if (!canOverride.twoOptionalFunctions(leftComponent, rightComponent, validator) && validator.isValidFunction(rightComponent))
+ if (!everyCombination(canOverride.twoOptionalFunctions, leftComponent, rightComponent, validator) && validator.isValidFunction(rightComponent))
continue propertyLoop;
}
component = left.components.filter(nameMatchFilter(right))[0];
mayOverride = compactable[right.name].canOverride || canOverride.sameValue;
- if (!mayOverride(component, right, validator))
+ if (!everyCombination(mayOverride, component, right, validator))
continue;
if (left.important && !right.important) {
}
mayOverride = compactable[right.name].canOverride || canOverride.sameValue;
- if (!mayOverride(left, right, validator))
+ if (!everyCombination(mayOverride, left, right, validator))
continue;
left.unused = true;
var hasInherit = require('./has-inherit');
var populateComponents = require('./populate-components');
var wrapSingle = require('./wrap-for-optimizing').single;
+var everyCombination = require('./every-combination');
function mixedImportance(components) {
var important;
if (hasInherit(component))
return;
- if (!canOverride(newProperty.components[i], component, validator))
+ if (!everyCombination(canOverride, newProperty.components[i], component, validator))
return;
newProperty.components[i] = deepClone(component);
--- /dev/null
+div{background:url(image.png),-webkit-linear-gradient(160.57deg,#4393b8 0,#346aa9 100%);background:url(image.png),-moz-linear-gradient(83.68% 67.94% 160.57deg,#4393b8 0,#346aa9 100%);background:url(image.png)25% 60% no-repeat,linear-gradient(160.57deg,#4393b8 0,#346aa9 100%)25% 60% no-repeat;z-index:1;background-size:100%;height:auto;min-height:820px}
--- /dev/null
+div {
+ background: url(image.png), -webkit-linear-gradient(160.57deg, #4393b8 0%, #346aa9 100%);
+ background: url(image.png), -moz-linear-gradient(83.68% 67.94% 160.57deg, #4393b8 0%, #346aa9 100%);
+ background: url(image.png), linear-gradient(160.57deg, #4393b8 0%, #346aa9 100%);
+ background-repeat: no-repeat;
+ background-position: 25% 60%;
+ z-index: 1;
+ background-size: 100%;
+ height: auto;
+ min-height: 820px;
+}
]);
}
},
- 'border-color - hex then rgb with multiple values123': {
+ 'border-color - hex then rgb with multiple values': {
'topic': 'a{border-color:red;border-color:#000 rgba(255,0,0,.5)}',
'into': function (topic) {
assert.deepEqual(_optimize(topic), [
]);
}
},
+ 'two multiplex shorthands with vendor specific functions123': {
+ 'topic': 'p{background:url(1.png),-webkit-linear-gradient();background:url(1.png),linear-gradient()}',
+ 'into': function (topic) {
+ assert.deepEqual(_optimize(topic), [
+ [['background', false , false], ['url(1.png)'], [','], ['-webkit-linear-gradient()']],
+ [['background', false , false], ['url(1.png)'], [','], ['linear-gradient()']]
+ ]);
+ }
+ },
'not too long into multiplex #1': {
'topic': 'p{background:top left;background-repeat:no-repeat,no-repeat}',
'into': function (topic) {