return stringifyProperty([fakeAsArray], 0).length;
}
+function moreSameShorthands(properties, startAt, name) {
+ // Since we run the main loop in `compactOverrides` backwards, at this point some
+ // properties may not be marked as unused.
+ // We should consider reverting the order if possible
+ var count = 0;
+
+ for (var i = startAt; i >= 0; i--) {
+ if (properties[i].name == name && !properties[i].unused)
+ count++;
+ if (count > 1)
+ break;
+ }
+
+ return count > 1;
+}
+
function wouldResultInLongerValue(left, right) {
if (!left.multiplex && !right.multiplex || left.multiplex && right.multiplex)
return false;
if (right.important && !left.important)
continue;
+ // Pending more clever algorithm in #527
+ if (moreSameShorthands(properties, i - 1, left.name))
+ continue;
+
component = left.components.filter(nameMatchFilter(right))[0];
if (everyCombination(mayOverride, component, right, validator)) {
var disabledBackgroundSizeMerging = !compatibility.properties.backgroundSizeMerging && component.name.indexOf('background-size') > -1;
-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}
+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}
\ No newline at end of file
]);
}
},
+ 'shorthand then longhand - two shorthands - pending #527': {
+ 'topic': 'p{background:-webkit-linear-gradient();background:linear-gradient();background-repeat:repeat-x}',
+ 'into': function (topic) {
+ assert.deepEqual(_optimize(topic), [
+ [['background', false , false], ['-webkit-linear-gradient()']],
+ [['background', false , false], ['linear-gradient()']],
+ [['background-repeat', false , false], ['repeat-x']]
+ ]);
+ }
+ },
+ 'shorthand then longhand - two shorthands and default - pending #527': {
+ 'topic': 'p{background:-webkit-linear-gradient();background:linear-gradient();background-repeat:repeat}',
+ 'into': function (topic) {
+ assert.deepEqual(_optimize(topic), [
+ [['background', false , false], ['-webkit-linear-gradient()']],
+ [['background', false , false], ['linear-gradient()']],
+ [['background-repeat', false , false], ['repeat']]
+ ]);
+ }
+ },
+ 'shorthand then longhand - two mergeable shorthands and default - pending #527': {
+ 'topic': 'p{background:__ESCAPED_URL_CLEAN_CSS0__;background:__ESCAPED_URL_CLEAN_CSS1__;background-repeat:repeat-x}',
+ 'into': function (topic) {
+ assert.deepEqual(_optimize(topic), [
+ [['background', false , false], ['__ESCAPED_URL_CLEAN_CSS1__']],
+ [['background-repeat', false , false], ['repeat-x']]
+ ]);
+ }
+ },
'shorthand then shorthand - same values': {
'topic': 'p{background:red;background:red}',
'into': function (topic) {
]);
}
},
- 'two multiplex shorthands with vendor specific functions123': {
+ 'two multiplex shorthands with vendor specific functions': {
'topic': 'p{background:url(1.png),-webkit-linear-gradient();background:url(1.png),linear-gradient()}',
'into': function (topic) {
assert.deepEqual(_optimize(topic), [