Comparing version 1.5.1 to 1.5.2
@@ -0,1 +1,5 @@ | ||
## 1.5.2 (January 24, 2016) | ||
- don't merge rulesets if between them a ruleset with same specificity (#264) | ||
## 1.5.1 (January 14, 2016) | ||
@@ -2,0 +6,0 @@ |
@@ -1,2 +0,3 @@ | ||
var unsafeToMerge = /vh|vw|vmin|vmax|vm|rem|\\9/; | ||
var allSidesAreEqual = /^(\S+)( \1){3}$/; | ||
var unsafeToMerge = /vh|vw|vmin|vmax|vm|rem|\\9|inherit|unset|initial|revert/; | ||
@@ -185,6 +186,2 @@ var TOP = 0; | ||
if (top && right && bottom && left) { | ||
if (unsafeToMerge.test([top.s, right.s, bottom.s, left.s].join(' '))) { | ||
return false; | ||
} | ||
var important = top.important + | ||
@@ -195,3 +192,17 @@ right.important + | ||
return important === 0 || important === 4 || important === this.important; | ||
if (important === 0 || important === 4 || important === this.important) { | ||
var values = [top.s, right.s, bottom.s, left.s].join(' '); | ||
console.log(values); | ||
if (allSidesAreEqual.test(values)) { | ||
return true; | ||
} | ||
if (unsafeToMerge.test(values)) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
} | ||
@@ -198,0 +209,0 @@ |
@@ -11,4 +11,4 @@ var utils = require('./utils.js'); | ||
var compareMarkers = {}; | ||
compareMarkers[selector[0].info.compareMarker] = true; | ||
var nodeCompareMarker = selector[0].info.compareMarker; | ||
var skippedCompareMarkers = {}; | ||
@@ -28,3 +28,9 @@ for (i = i + 1; i < array.length; i++) { | ||
var nextBlock = next.block.declarations; | ||
var nextCompareMarker = nextFirstSelector.info.compareMarker; | ||
// if next ruleset has same marked as one of skipped then stop joining | ||
if (nextCompareMarker in skippedCompareMarkers) { | ||
return; | ||
} | ||
// try to join by selectors | ||
@@ -46,6 +52,5 @@ if (selector.length === 1) { | ||
// try to join by properties | ||
var nextCompareMarker = nextFirstSelector.info.compareMarker; | ||
var equalBlocks = true; | ||
if (block.length === nextBlock.length) { | ||
var equalBlocks = true; | ||
if (block.length === nextBlock.length) { | ||
for (var j = 0; j < block.length; j++) { | ||
@@ -68,3 +73,2 @@ if (block[j].info.s !== nextBlock[j].info.s) { | ||
compareMarkers[nextCompareMarker] = true; | ||
array.splice(i, 1); | ||
@@ -77,7 +81,9 @@ i--; | ||
// go to next ruleset if simpleselectors has no equal specifity and element selector | ||
if (nextCompareMarker in compareMarkers) { | ||
// go to next ruleset if current one can be skipped (has no equal specificity nor element selector) | ||
if (nextCompareMarker === nodeCompareMarker) { | ||
return; | ||
} | ||
skippedCompareMarkers[nextCompareMarker] = true; | ||
} | ||
}; |
{ | ||
"name": "csso", | ||
"description": "CSSO — CSS optimizer", | ||
"version": "1.5.1", | ||
"version": "1.5.2", | ||
"homepage": "https://github.com/css/csso", | ||
@@ -6,0 +6,0 @@ "author": "Sergey Kryzhanovsky <skryzhanovsky@ya.ru> (https://github.com/afelix)", |
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
264364
5677
1
4