Fixes list-style-* advanced processing.
authorJakub Pawlowicz <jakub@goalsmashers.com>
Sun, 8 Jun 2014 14:07:25 +0000 (15:07 +0100)
committerJakub Pawlowicz <jakub@goalsmashers.com>
Sun, 8 Jun 2014 14:08:31 +0000 (15:08 +0100)
History.md
lib/properties/optimizer.js
test/unit-test.js

index 200be59..4d4b90d 100644 (file)
@@ -7,6 +7,7 @@
 * Adds `--rounding-precision` to control rounding precision.
 * Moves quotation matching into a `QuoteScanner` class.
 * Adds `npm run browserify` for creating embeddable version of clean-css.
+* Fixed list-style-* advanced processing.
 * Fixed issue [#134](https://github.com/GoalSmashers/clean-css/issues/134) - merges properties into shorthand form.
 * Fixed issue [#164](https://github.com/GoalSmashers/clean-css/issues/164) - removes default values if not needed.
 * Fixed issue [#168](https://github.com/GoalSmashers/clean-css/issues/168) - adds better property merging algorithm.
index aea10b5..fe7903e 100644 (file)
@@ -69,9 +69,9 @@ module.exports = function Optimizer(compatibility, aggressiveMerging) {
     'font-style': ['font'],
     'font-variant': ['font'],
     'font-weight': ['font'],
-    'list-style-image': ['list'],
-    'list-style-position': ['list'],
-    'list-style-type': ['list'],
+    'list-style-image': ['list-style'],
+    'list-style-position': ['list-style'],
+    'list-style-type': ['list-style'],
     'margin-bottom': ['margin'],
     'margin-left': ['margin'],
     'margin-right': ['margin'],
index 83f833f..873668d 100644 (file)
@@ -59,13 +59,14 @@ var redefineContext = function(redefinitions, options) {
       for (var j = 0, m = prefixes.length; j < m; j++) {
         var prefixedProperty = prefixes[j] + property;
         var prefixedBy = prefixes[j] + by;
+        var zeroValue = options.noneFor.indexOf(prefixedProperty) > -1 ? 'none' : '0';
 
         context['should override ' + prefixedProperty + ' by ' + prefixedBy] = [
-          'a{' + prefixedProperty + ':inherit;' + prefixedBy + ':0}',
-          'a{' + prefixedBy + ':0}'
+          'a{' + prefixedProperty + ':inherit;' + prefixedBy + ':' + zeroValue + '}',
+          'a{' + prefixedBy + ':' + zeroValue + '}'
         ];
         context['should not override ' + prefixedBy + ' by ' + prefixedProperty] =
-          'a{' + prefixedBy + ':0;' + prefixedProperty + ':inherit}';
+          'a{' + prefixedBy + ':' + zeroValue + ';' + prefixedProperty + ':inherit}';
       }
     }
   }
@@ -1633,9 +1634,9 @@ title']{display:block}",
     'font-style': ['font'],
     'font-variant': ['font'],
     'font-weight': ['font'],
-    'list-style-image': ['list'],
-    'list-style-position': ['list'],
-    'list-style-type': ['list'],
+    'list-style-image': ['list-style'],
+    'list-style-position': ['list-style'],
+    'list-style-type': ['list-style'],
     'margin-bottom': ['margin'],
     'margin-left': ['margin'],
     'margin-right': ['margin'],
@@ -1651,7 +1652,7 @@ title']{display:block}",
     'transition-duration': ['transition'],
     'transition-property': ['transition'],
     'transition-timing-function': ['transition']
-  }, { vendorPrefixes: ['animation', 'transition'] }),
+  }, { vendorPrefixes: ['animation', 'transition'], noneFor: ['list-style-image'] }),
   'redefined more granular properties with property merging': cssContext({
     'should merge background with background-attachment': [
       'a{background:0;background-attachment:fixed}',