1
0
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:
s2
2022-08-20 18:51:33 +02:00
parent 09663a35a5
commit 806ebf9a57
4513 changed files with 366205 additions and 92512 deletions

View File

@@ -27,20 +27,17 @@ function reduceNonAdjacent(tokens, context) {
}
var selectorAsString = serializeRules(token[1]);
var isComplexAndNotSpecial = token[1].length > 1 &&
isMergeable(selectorAsString, mergeablePseudoClasses, mergeablePseudoElements, multiplePseudoMerging);
var isComplexAndNotSpecial = token[1].length > 1
&& isMergeable(selectorAsString, mergeablePseudoClasses, mergeablePseudoElements, multiplePseudoMerging);
var wrappedSelectors = wrappedSelectorsFrom(token[1]);
var selectors = isComplexAndNotSpecial ?
[selectorAsString].concat(wrappedSelectors) :
[selectorAsString];
var selectors = isComplexAndNotSpecial
? [selectorAsString].concat(wrappedSelectors)
: [selectorAsString];
for (var j = 0, m = selectors.length; j < m; j++) {
var selector = selectors[j];
if (!candidates[selector])
candidates[selector] = [];
else
repeated.push(selector);
if (!candidates[selector]) { candidates[selector] = []; } else { repeated.push(selector); }
candidates[selector].push({
where: i,
@@ -71,8 +68,7 @@ function reduceSimpleNonAdjacentCases(tokens, repeated, candidates, options, con
}
function reduceBody(token, newBody, processedCount, tokenIdx) {
if (!data[processedCount - tokenIdx - 1].isPartial)
token[2] = newBody;
if (!data[processedCount - tokenIdx - 1].isPartial) { token[2] = newBody; }
}
for (var i = 0, l = repeated.length; i < l; i++) {
@@ -97,23 +93,21 @@ function reduceComplexNonAdjacentCases(tokens, candidates, options, context) {
}
function collectReducedBodies(token, newBody, processedCount, tokenIdx) {
if (tokenIdx === 0)
localContext.reducedBodies.push(newBody);
if (tokenIdx === 0) { localContext.reducedBodies.push(newBody); }
}
allSelectors:
for (var complexSelector in candidates) {
var into = candidates[complexSelector];
if (!into[0].isComplex)
continue;
if (!into[0].isComplex) { continue; }
var intoPosition = into[into.length - 1].where;
var intoToken = tokens[intoPosition];
var reducedBodies = [];
var selectors = isMergeable(complexSelector, mergeablePseudoClasses, mergeablePseudoElements, multiplePseudoMerging) ?
into[0].list :
[complexSelector];
var selectors = isMergeable(complexSelector, mergeablePseudoClasses, mergeablePseudoElements, multiplePseudoMerging)
? into[0].list
: [complexSelector];
localContext.intoPosition = intoPosition;
localContext.reducedBodies = reducedBodies;
@@ -122,8 +116,7 @@ function reduceComplexNonAdjacentCases(tokens, candidates, options, context) {
var selector = selectors[j];
var data = candidates[selector];
if (data.length < 2)
continue allSelectors;
if (data.length < 2) { continue allSelectors; }
localContext.data = data;
@@ -132,8 +125,9 @@ function reduceComplexNonAdjacentCases(tokens, candidates, options, context) {
callback: collectReducedBodies
}, options, context);
if (serializeBody(reducedBodies[reducedBodies.length - 1]) != serializeBody(reducedBodies[0]))
if (serializeBody(reducedBodies[reducedBodies.length - 1]) != serializeBody(reducedBodies[0])) {
continue allSelectors;
}
}
intoToken[2] = reducedBodies[0];
@@ -146,8 +140,7 @@ function reduceSelector(tokens, data, context, options, outerContext) {
var processedTokens = [];
for (var j = data.length - 1; j >= 0; j--) {
if (context.filterOut(j, bodies))
continue;
if (context.filterOut(j, bodies)) { continue; }
var where = data[j].where;
var token = tokens[where];
@@ -165,7 +158,8 @@ function reduceSelector(tokens, data, context, options, outerContext) {
var tokenIdx = processedCount - 1;
while (tokenIdx >= 0) {
if ((tokenIdx === 0 || (bodies[propertyIdx] && bodiesAsList[tokenIdx].indexOf(bodies[propertyIdx]) > -1)) && propertyIdx > -1) {
if ((tokenIdx === 0
|| (bodies[propertyIdx] && bodiesAsList[tokenIdx].indexOf(bodies[propertyIdx]) > -1)) && propertyIdx > -1) {
propertyIdx--;
continue;
}