Comparing version 1.8.1 to 1.8.2
@@ -0,1 +1,7 @@ | ||
## 1.8.2 (June 22, 2016) | ||
- Fix wrong declaration with `\9` hack merge (#295) | ||
- Take in account functions when merge TRBL-properties (#297) | ||
- Improve partial merge (#304) | ||
## 1.8.1 (March 30, 2016) | ||
@@ -2,0 +8,0 @@ |
@@ -121,2 +121,6 @@ var List = require('../../utils/list.js'); | ||
case 'Function': | ||
special = child.name; | ||
break; | ||
case 'Space': | ||
@@ -123,0 +127,0 @@ return false; // ignore space |
@@ -85,3 +85,3 @@ var resolveProperty = require('../ast/names.js').property; | ||
if (name === '\\9') { | ||
if (/\\9/.test(name)) { | ||
hack9 = name; | ||
@@ -88,0 +88,0 @@ } |
@@ -28,6 +28,2 @@ var List = require('../../utils/list.js'); | ||
function inList(selector) { | ||
return selector.compareMarker in this; | ||
} | ||
function processRuleset(node, item, list) { | ||
@@ -37,3 +33,5 @@ var avoidRulesMerge = this.stylesheet.avoidRulesMerge; | ||
var block = node.block; | ||
var skippedCompareMarkers = Object.create(null); | ||
var disallowDownMarkers = Object.create(null); | ||
var allowMergeUp = true; | ||
var allowMergeDown = true; | ||
@@ -53,4 +51,8 @@ list.prevUntil(item.prev, function(prev, prevItem) { | ||
allowMergeDown = !prevSelectors.some(function(selector) { | ||
return selector.compareMarker in disallowDownMarkers; | ||
}); | ||
// try prev ruleset if simpleselectors has no equal specifity and element selector | ||
if (prevSelectors.some(inList, skippedCompareMarkers)) { | ||
if (!allowMergeDown && !allowMergeUp) { | ||
return true; | ||
@@ -60,3 +62,3 @@ } | ||
// try to join by selectors | ||
if (utils.isEqualLists(prevSelectors, selectors)) { | ||
if (allowMergeUp && utils.isEqualLists(prevSelectors, selectors)) { | ||
prevBlock.declarations.appendList(block.declarations); | ||
@@ -75,4 +77,7 @@ list.remove(item); | ||
// equal blocks | ||
utils.addSelectors(selectors, prevSelectors); | ||
list.remove(prevItem); | ||
if (allowMergeDown) { | ||
utils.addSelectors(selectors, prevSelectors); | ||
list.remove(prevItem); | ||
} | ||
return true; | ||
@@ -87,3 +92,3 @@ } else if (!avoidRulesMerge) { /* probably we don't need to prevent those merges for @keyframes | ||
if (selectorLength < blockLength) { | ||
if (allowMergeUp && selectorLength < blockLength) { | ||
utils.addSelectors(prevSelectors, selectors); | ||
@@ -97,3 +102,3 @@ block.declarations = new List(diff.ne1); | ||
if (selectorLength < blockLength) { | ||
if (allowMergeDown && selectorLength < blockLength) { | ||
utils.addSelectors(selectors, prevSelectors); | ||
@@ -115,3 +120,3 @@ prevBlock.declarations = new List(diff.ne2); | ||
// ruleset description overhead | ||
if (blockLength >= newBlockLength) { | ||
if (allowMergeDown && blockLength >= newBlockLength) { | ||
var newRuleset = { | ||
@@ -138,4 +143,14 @@ type: 'Ruleset', | ||
if (allowMergeUp) { | ||
// TODO: disallow up merge only if any property interception only (i.e. diff.ne2overrided.length > 0); | ||
// await property families to find property interception correctly | ||
allowMergeUp = !prevSelectors.some(function(prevSelector) { | ||
return selectors.some(function(selector) { | ||
return selector.compareMarker === prevSelector.compareMarker; | ||
}); | ||
}); | ||
} | ||
prevSelectors.each(function(data) { | ||
skippedCompareMarkers[data.compareMarker] = true; | ||
disallowDownMarkers[data.compareMarker] = true; | ||
}); | ||
@@ -142,0 +157,0 @@ }); |
{ | ||
"name": "csso", | ||
"version": "1.8.1", | ||
"version": "1.8.2", | ||
"description": "CSSO (CSS Optimizer) is a CSS minifier with structural optimisations", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
327481
6555