mirror of
https://github.com/S2-/minifyfromhtml.git
synced 2025-08-04 20:40:07 +02:00
update packages to latest version
This commit is contained in:
32
node_modules/clean-css/lib/optimizer/level-2/merge-non-adjacent-by-body.js
generated
vendored
32
node_modules/clean-css/lib/optimizer/level-2/merge-non-adjacent-by-body.js
generated
vendored
@@ -20,7 +20,7 @@ function isBemElement(token) {
|
||||
}
|
||||
|
||||
function withoutModifier(selector) {
|
||||
return selector.replace(/--[^ ,>\+~:]+/g, '');
|
||||
return selector.replace(/--[^ ,>+~:]+/g, '');
|
||||
}
|
||||
|
||||
function removeAnyUnsafeElements(left, candidates) {
|
||||
@@ -30,8 +30,9 @@ function removeAnyUnsafeElements(left, candidates) {
|
||||
var right = candidates[body];
|
||||
var rightSelector = withoutModifier(serializeRules(right[1]));
|
||||
|
||||
if (rightSelector.indexOf(leftSelector) > -1 || leftSelector.indexOf(rightSelector) > -1)
|
||||
if (rightSelector.indexOf(leftSelector) > -1 || leftSelector.indexOf(rightSelector) > -1) {
|
||||
delete candidates[body];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,21 +48,28 @@ function mergeNonAdjacentByBody(tokens, context) {
|
||||
|
||||
for (var i = tokens.length - 1; i >= 0; i--) {
|
||||
var token = tokens[i];
|
||||
if (token[0] != Token.RULE)
|
||||
continue;
|
||||
if (token[0] != Token.RULE) { continue; }
|
||||
|
||||
if (token[2].length > 0 && (!mergeSemantically && unsafeSelector(serializeRules(token[1]))))
|
||||
candidates = {};
|
||||
if (token[2].length > 0 && (!mergeSemantically && unsafeSelector(serializeRules(token[1])))) { candidates = {}; }
|
||||
|
||||
if (token[2].length > 0 && mergeSemantically && isBemElement(token))
|
||||
removeAnyUnsafeElements(token, candidates);
|
||||
if (token[2].length > 0 && mergeSemantically && isBemElement(token)) { removeAnyUnsafeElements(token, candidates); }
|
||||
|
||||
var candidateBody = serializeBody(token[2]);
|
||||
var oldToken = candidates[candidateBody];
|
||||
if (oldToken &&
|
||||
isMergeable(serializeRules(token[1]), mergeablePseudoClasses, mergeablePseudoElements, multiplePseudoMerging) &&
|
||||
isMergeable(serializeRules(oldToken[1]), mergeablePseudoClasses, mergeablePseudoElements, multiplePseudoMerging)) {
|
||||
|
||||
if (oldToken
|
||||
&& isMergeable(
|
||||
serializeRules(token[1]),
|
||||
mergeablePseudoClasses,
|
||||
mergeablePseudoElements,
|
||||
multiplePseudoMerging
|
||||
)
|
||||
&& isMergeable(
|
||||
serializeRules(oldToken[1]),
|
||||
mergeablePseudoClasses,
|
||||
mergeablePseudoElements,
|
||||
multiplePseudoMerging
|
||||
)
|
||||
) {
|
||||
if (token[2].length > 0) {
|
||||
token[1] = tidyRules(oldToken[1].concat(token[1]), false, adjacentSpace, false, context.warnings);
|
||||
token[1] = token[1].length > 1 ? sortSelectors(token[1], selectorsSortingMethod) : token[1];
|
||||
|
Reference in New Issue
Block a user