* Fixed issue [#397](https://github.com/jakubpawlowicz/clean-css/issues/397) - support for source map sources.
* Fixed issue [#399](https://github.com/jakubpawlowicz/clean-css/issues/399) - support compacting with source maps.
* Fixed issue [#429](https://github.com/jakubpawlowicz/clean-css/issues/429) - unifies data tokenization.
+* 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 [#500](https://github.com/jakubpawlowicz/clean-css/issues/500) - merging duplicate adjacent properties.
return components;
}
- var values = property.value;
+ var values = property.value.slice(0);
+ var total = values.length;
var index = 0;
- if (index < values.length && validator.isValidListStyleType(values[index][0]))
- type.value = [values[index++]];
- if (index < values.length && validator.isValidListStylePosition(values[index][0]))
- position.value = [values[index++]];
- if (index < values.length)
- image.value = [values[index]];
+ // `image` first...
+ for (index = 0, total = values.length; index < total; index++) {
+ if (validator.isValidUrl(values[index][0]) || values[index][0] == '0') {
+ image.value = [values[index]];
+ values.splice(index, 1);
+ break;
+ }
+ }
+
+ // ... then `type`...
+ for (index = 0, total = values.length; index < total; index++) {
+ if (validator.isValidListStyleType(values[index][0])) {
+ type.value = [values[index]];
+ values.splice(index, 1);
+ break;
+ }
+ }
+
+ // ... and what's left is a `position`
+ if (values.length > 0 && validator.isValidListStylePosition(values[0][0]))
+ position.value = [values[0]];
return components;
}
assert.equal(components[2].name, 'list-style-image');
assert.deepEqual(components[2].value, [['none']]);
}
+ },
+ 'fuzzy matching': {
+ 'topic': function () {
+ return _breakUp([[['list-style'], ['__ESCAPED_URL_CLEAN_CSS0__'], ['outside'], ['none']]]);
+ },
+ 'has 3 components': function (components) {
+ assert.lengthOf(components, 3);
+ },
+ 'has list-style-type': function (components) {
+ assert.equal(components[0].name, 'list-style-type');
+ assert.deepEqual(components[0].value, [['none']]);
+ },
+ 'has list-style-position': function (components) {
+ assert.equal(components[1].name, 'list-style-position');
+ assert.deepEqual(components[1].value, [['outside']]);
+ },
+ 'has list-style-image': function (components) {
+ assert.equal(components[2].name, 'list-style-image');
+ assert.deepEqual(components[2].value, [['__ESCAPED_URL_CLEAN_CSS0__']]);
+ }
}
},
'multiple values': {
}
}
})
+ .addBatch({
+ 'list-style fuzzy matching': {
+ 'topic': 'p{list-style:inside none}',
+ 'into': function (topic) {
+ assert.deepEqual(_optimize(topic, false, true), [
+ [['list-style', false , false], ['none'], ['inside']]
+ ]);
+ }
+ }
+ })
.addBatch({
'ie hacks - normal before hack': {
'topic': 'p{color:red;display:none;color:#fff\\9}',
},
'list with all values': {
'topic': function () {
- return _restore(_breakUp([['list-style'], ['circle'], ['inside'], ['url()']]));
+ return _restore(_breakUp([['list-style'], ['circle'], ['inside'], ['__ESCAPED_URL_CLEAN_CSS1__']]));
},
'gives right value back': function (restoredValue) {
- assert.deepEqual(restoredValue, [['circle'], ['inside'], ['url()']]);
+ assert.deepEqual(restoredValue, [['circle'], ['inside'], ['__ESCAPED_URL_CLEAN_CSS1__']]);
}
},
'list with some defaults': {