aboutsummaryrefslogtreecommitdiff
path: root/node_modules/clean-css
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-08-14 05:01:11 +0200
committerFlorian Dold <florian.dold@gmail.com>2017-08-14 05:02:09 +0200
commit363723fc84f7b8477592e0105aeb331ec9a017af (patch)
tree29f92724f34131bac64d6a318dd7e30612e631c7 /node_modules/clean-css
parent5634e77ad96bfe1818f6b6ee70b7379652e5487f (diff)
downloadwallet-core-363723fc84f7b8477592e0105aeb331ec9a017af.tar.xz
node_modules
Diffstat (limited to 'node_modules/clean-css')
-rw-r--r--node_modules/clean-css/History.md22
-rw-r--r--node_modules/clean-css/lib/optimizer/level-1/optimize.js15
-rw-r--r--node_modules/clean-css/lib/optimizer/level-1/tidy-rules.js2
-rw-r--r--node_modules/clean-css/lib/optimizer/level-2/remove-unused-at-rules.js25
-rw-r--r--node_modules/clean-css/lib/tokenizer/tokenize.js46
-rw-r--r--node_modules/clean-css/lib/writer/helpers.js6
-rw-r--r--node_modules/clean-css/package.json2
7 files changed, 99 insertions, 19 deletions
diff --git a/node_modules/clean-css/History.md b/node_modules/clean-css/History.md
index 2a4bab0c3..5700de325 100644
--- a/node_modules/clean-css/History.md
+++ b/node_modules/clean-css/History.md
@@ -1,3 +1,25 @@
+[4.1.7 / 2017-07-14](https://github.com/jakubpawlowicz/clean-css/compare/v4.1.6...v4.1.7)
+==================
+
+* Fixed issue [#957](https://github.com/jakubpawlowicz/clean-css/issues/957) - `0%` minification of `width` property.
+
+[4.1.6 / 2017-07-08](https://github.com/jakubpawlowicz/clean-css/compare/v4.1.5...v4.1.6)
+==================
+
+* Fixed issue [#887](https://github.com/jakubpawlowicz/clean-css/issues/887) - edge case in serializing comments.
+* Fixed issue [#953](https://github.com/jakubpawlowicz/clean-css/issues/953) - beautify breaks attribute selectors.
+
+[4.1.5 / 2017-06-29](https://github.com/jakubpawlowicz/clean-css/compare/v4.1.4...v4.1.5)
+==================
+
+* Fixed issue [#945](https://github.com/jakubpawlowicz/clean-css/issues/945) - hex RGBA colors in IE filters.
+* Fixed issue [#952](https://github.com/jakubpawlowicz/clean-css/issues/952) - parsing `@page` according to CSS3 spec.
+
+[4.1.4 / 2017-06-14](https://github.com/jakubpawlowicz/clean-css/compare/v4.1.3...v4.1.4)
+==================
+
+* Fixed issue [#950](https://github.com/jakubpawlowicz/clean-css/issues/950) - bug in removing unused `@font-face` rules.
+
[4.1.3 / 2017-05-18](https://github.com/jakubpawlowicz/clean-css/compare/v4.1.2...v4.1.3)
==================
diff --git a/node_modules/clean-css/lib/optimizer/level-1/optimize.js b/node_modules/clean-css/lib/optimizer/level-1/optimize.js
index 5a6da47c0..82cb9531d 100644
--- a/node_modules/clean-css/lib/optimizer/level-1/optimize.js
+++ b/node_modules/clean-css/lib/optimizer/level-1/optimize.js
@@ -98,11 +98,11 @@ function optimizeColors(name, value, compatibility) {
.replace(/hsl\((-?\d+),(-?\d+)%?,(-?\d+)%?\)/g, function (match, hue, saturation, lightness) {
return shortenHsl(hue, saturation, lightness);
})
- .replace(/(^|[^='"])#([0-9a-f]{6})/gi, function (match, prefix, color) {
+ .replace(/(^|[^='"])#([0-9a-f]{6})($|[^0-9a-f])/gi, function (match, prefix, color, suffix) {
if (color[0] == color[1] && color[2] == color[3] && color[4] == color[5]) {
- return (prefix + '#' + color[0] + color[2] + color[4]).toLowerCase();
+ return (prefix + '#' + color[0] + color[2] + color[4]).toLowerCase() + suffix;
} else {
- return (prefix + '#' + color).toLowerCase();
+ return (prefix + '#' + color).toLowerCase() + suffix;
}
})
.replace(/(^|[^='"])#([0-9a-f]{3})/gi, function (match, prefix, color) {
@@ -269,7 +269,7 @@ function optimizeUnits(name, value, unitsRegexp) {
return value;
}
- if (value.indexOf('%') > 0 && (name == 'height' || name == 'max-height')) {
+ if (value.indexOf('%') > 0 && (name == 'height' || name == 'max-height' || name == 'width' || name == 'max-width')) {
return value;
}
@@ -491,10 +491,7 @@ function optimizeBody(properties, context) {
restoreFromOptimizing(_properties);
removeUnused(_properties);
-
- if (_properties.length != properties.length) {
- removeComments(properties, options);
- }
+ removeComments(properties, options);
}
function removeComments(tokens, options) {
@@ -654,7 +651,7 @@ function level1Optimize(tokens, context) {
break;
}
- if (levelOptions.removeEmpty && (token[1].length === 0 || (token[2] && token[2].length === 0))) {
+ if (token[0] == Token.COMMENT && token[1].length === 0 || levelOptions.removeEmpty && (token[1].length === 0 || (token[2] && token[2].length === 0))) {
tokens.splice(i, 1);
i--;
l--;
diff --git a/node_modules/clean-css/lib/optimizer/level-1/tidy-rules.js b/node_modules/clean-css/lib/optimizer/level-1/tidy-rules.js
index b47ed6b79..0af3b2fe7 100644
--- a/node_modules/clean-css/lib/optimizer/level-1/tidy-rules.js
+++ b/node_modules/clean-css/lib/optimizer/level-1/tidy-rules.js
@@ -70,7 +70,7 @@ function removeWhitespace(value, format) {
isNewLineNix = character == Marker.NEW_LINE_NIX;
isNewLineWin = character == Marker.NEW_LINE_NIX && value[i - 1] == Marker.NEW_LINE_WIN;
isQuoted = isSingleQuoted || isDoubleQuoted;
- isRelation = !isEscaped && roundBracketLevel === 0 && RELATION_PATTERN.test(character);
+ isRelation = !isAttribute && !isEscaped && roundBracketLevel === 0 && RELATION_PATTERN.test(character);
isWhitespace = WHITESPACE_PATTERN.test(character);
if (wasEscaped && isQuoted && isNewLineWin) {
diff --git a/node_modules/clean-css/lib/optimizer/level-2/remove-unused-at-rules.js b/node_modules/clean-css/lib/optimizer/level-2/remove-unused-at-rules.js
index e60d5e7c2..7285991a4 100644
--- a/node_modules/clean-css/lib/optimizer/level-2/remove-unused-at-rules.js
+++ b/node_modules/clean-css/lib/optimizer/level-2/remove-unused-at-rules.js
@@ -19,7 +19,8 @@ function removeUnusedAtRules(tokens, context) {
function removeUnusedAtRule(tokens, matchCallback, markCallback, context) {
var atRules = {};
var atRule;
- var token;
+ var atRuleTokens;
+ var atRuleToken;
var zeroAt;
var i, l;
@@ -34,9 +35,13 @@ function removeUnusedAtRule(tokens, matchCallback, markCallback, context) {
markUsedAtRules(tokens, markCallback, atRules, context);
for (atRule in atRules) {
- token = atRules[atRule];
- zeroAt = token[0] == Token.AT_RULE ? 1 : 2;
- token[zeroAt] = [];
+ atRuleTokens = atRules[atRule];
+
+ for (i = 0, l = atRuleTokens.length; i < l; i++) {
+ atRuleToken = atRuleTokens[i];
+ zeroAt = atRuleToken[0] == Token.AT_RULE ? 1 : 2;
+ atRuleToken[zeroAt] = [];
+ }
}
}
@@ -60,7 +65,8 @@ function matchCounterStyle(token, atRules) {
if (token[0] == Token.AT_RULE_BLOCK && token[1][0][1].indexOf('@counter-style') === 0) {
match = token[1][0][1].split(' ')[1];
- atRules[match] = token;
+ atRules[match] = atRules[match] || [];
+ atRules[match].push(token);
}
}
@@ -102,7 +108,8 @@ function matchFontFace(token, atRules) {
if (property[1][1] == 'font-family') {
match = property[2][1].toLowerCase();
- atRules[match] = token;
+ atRules[match] = atRules[match] || [];
+ atRules[match].push(token);
break;
}
}
@@ -155,7 +162,8 @@ function matchKeyframe(token, atRules) {
if (token[0] == Token.NESTED_BLOCK && keyframeRegex.test(token[1][0][1])) {
match = token[1][0][1].split(' ')[1];
- atRules[match] = token;
+ atRules[match] = atRules[match] || [];
+ atRules[match].push(token);
}
}
@@ -200,7 +208,8 @@ function matchNamespace(token, atRules) {
if (token[0] == Token.AT_RULE && token[1].indexOf('@namespace') === 0) {
match = token[1].split(' ')[1];
- atRules[match] = token;
+ atRules[match] = atRules[match] || [];
+ atRules[match].push(token);
}
}
diff --git a/node_modules/clean-css/lib/tokenizer/tokenize.js b/node_modules/clean-css/lib/tokenizer/tokenize.js
index 7c071dd93..018b89de8 100644
--- a/node_modules/clean-css/lib/tokenizer/tokenize.js
+++ b/node_modules/clean-css/lib/tokenizer/tokenize.js
@@ -28,6 +28,34 @@ var BLOCK_RULES = [
'@supports'
];
+var PAGE_MARGIN_BOXES = [
+ '@bottom-center',
+ '@bottom-left',
+ '@bottom-left-corner',
+ '@bottom-right',
+ '@bottom-right-corner',
+ '@left-bottom',
+ '@left-middle',
+ '@left-top',
+ '@right-bottom',
+ '@right-middle',
+ '@right-top',
+ '@top-center',
+ '@top-left',
+ '@top-left-corner',
+ '@top-right',
+ '@top-right-corner'
+];
+
+var EXTRA_PAGE_BOXES = [
+ '@footnote',
+ '@footnotes',
+ '@left',
+ '@page-float-bottom',
+ '@page-float-top',
+ '@right'
+];
+
var REPEAT_PATTERN = /^\[\s*\d+\s*\]$/;
var RULE_WORD_SEPARATOR_PATTERN = /[\s\(]/;
var TAIL_BROKEN_VALUE_PATTERN = /[\s|\}]*$/;
@@ -221,6 +249,18 @@ function intoTokens(source, externalContext, internalContext, isNested) {
levels.push(level);
level = Level.RULE;
seekingValue = false;
+ } else if (character == Marker.OPEN_CURLY_BRACKET && level == Level.RULE && isPageMarginBox(buffer)) {
+ // open brace opening page-margin box at rule level, e.g. @page{@top-center{<--
+ serializedBuffer = buffer.join('').trim();
+ ruleTokens.push(ruleToken);
+ ruleToken = [Token.AT_RULE_BLOCK, [], []];
+ ruleToken[1].push([Token.AT_RULE_BLOCK_SCOPE, serializedBuffer, [originalMetadata(metadata, serializedBuffer, externalContext)]]);
+ newTokens.push(ruleToken);
+ newTokens = ruleToken[2];
+
+ levels.push(level);
+ level = Level.RULE;
+ buffer = [];
} else if (character == Marker.COLON && level == Level.RULE && !seekingValue) {
// colon at rule level, e.g. a{color:<--
serializedBuffer = buffer.join('').trim();
@@ -467,6 +507,12 @@ function tokenScopeFrom(tokenType) {
}
}
+function isPageMarginBox(buffer) {
+ var serializedBuffer = buffer.join('').trim();
+
+ return PAGE_MARGIN_BOXES.indexOf(serializedBuffer) > -1 || EXTRA_PAGE_BOXES.indexOf(serializedBuffer) > -1;
+}
+
function isRepeatToken(buffer) {
return REPEAT_PATTERN.test(buffer.join('') + Marker.CLOSE_SQUARE_BRACKET);
}
diff --git a/node_modules/clean-css/lib/writer/helpers.js b/node_modules/clean-css/lib/writer/helpers.js
index ab08633e8..da13cf6eb 100644
--- a/node_modules/clean-css/lib/writer/helpers.js
+++ b/node_modules/clean-css/lib/writer/helpers.js
@@ -87,6 +87,12 @@ function property(context, tokens, position, lastPropertyAt) {
store(context, token);
store(context, semicolon(context, Breaks.AfterProperty, false));
break;
+ case Token.AT_RULE_BLOCK:
+ rules(context, token[1]);
+ store(context, openBrace(context, Breaks.AfterRuleBegins, true));
+ body(context, token[2]);
+ store(context, closeBrace(context, Breaks.AfterRuleEnds, false, isLast));
+ break;
case Token.COMMENT:
store(context, token);
break;
diff --git a/node_modules/clean-css/package.json b/node_modules/clean-css/package.json
index d612da4e3..83450d0ad 100644
--- a/node_modules/clean-css/package.json
+++ b/node_modules/clean-css/package.json
@@ -1,6 +1,6 @@
{
"name": "clean-css",
- "version": "4.1.3",
+ "version": "4.1.7",
"author": "Jakub Pawlowicz <contact@jakubpawlowicz.com> (http://twitter.com/jakubpawlowicz)",
"description": "A well-tested CSS minifier",
"license": "MIT",