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:
49
node_modules/clean-css/lib/optimizer/level-2/is-mergeable.js
generated
vendored
49
node_modules/clean-css/lib/optimizer/level-2/is-mergeable.js
generated
vendored
@@ -15,7 +15,7 @@ var PSEUDO_CLASSES_WITH_ARGUMENTS = [
|
||||
':nth-last-of-type',
|
||||
':nth-of-type'
|
||||
];
|
||||
var RELATION_PATTERN = /[>\+~]/;
|
||||
var RELATION_PATTERN = /[>+~]/;
|
||||
var UNMIXABLE_PSEUDO_CLASSES = [
|
||||
':after',
|
||||
':before',
|
||||
@@ -44,10 +44,17 @@ function isMergeable(selector, mergeablePseudoClasses, mergeablePseudoElements,
|
||||
for (i = 0, l = singleSelectors.length; i < l; i++) {
|
||||
singleSelector = singleSelectors[i];
|
||||
|
||||
if (singleSelector.length === 0 ||
|
||||
isDeepSelector(singleSelector) ||
|
||||
isVendorPrefixed(singleSelector) ||
|
||||
(singleSelector.indexOf(Marker.COLON) > -1 && !areMergeable(singleSelector, extractPseudoFrom(singleSelector), mergeablePseudoClasses, mergeablePseudoElements, multiplePseudoMerging))) {
|
||||
if (singleSelector.length === 0
|
||||
|| isDeepSelector(singleSelector)
|
||||
|| isVendorPrefixed(singleSelector)
|
||||
|| (singleSelector.indexOf(Marker.COLON) > -1
|
||||
&& !areMergeable(
|
||||
singleSelector,
|
||||
extractPseudoFrom(singleSelector),
|
||||
mergeablePseudoClasses,
|
||||
mergeablePseudoElements,
|
||||
multiplePseudoMerging
|
||||
))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -143,10 +150,10 @@ function extractPseudoFrom(selector) {
|
||||
}
|
||||
|
||||
function areMergeable(selector, matches, mergeablePseudoClasses, mergeablePseudoElements, multiplePseudoMerging) {
|
||||
return areAllowed(matches, mergeablePseudoClasses, mergeablePseudoElements) &&
|
||||
needArguments(matches) &&
|
||||
(matches.length < 2 || !someIncorrectlyChained(selector, matches)) &&
|
||||
(matches.length < 2 || multiplePseudoMerging && allMixable(matches));
|
||||
return areAllowed(matches, mergeablePseudoClasses, mergeablePseudoElements)
|
||||
&& needArguments(matches)
|
||||
&& (matches.length < 2 || !someIncorrectlyChained(selector, matches))
|
||||
&& (matches.length < 2 || multiplePseudoMerging && allMixable(matches));
|
||||
}
|
||||
|
||||
function areAllowed(matches, mergeablePseudoClasses, mergeablePseudoElements) {
|
||||
@@ -156,9 +163,9 @@ function areAllowed(matches, mergeablePseudoClasses, mergeablePseudoElements) {
|
||||
|
||||
for (i = 0, l = matches.length; i < l; i++) {
|
||||
match = matches[i];
|
||||
name = match.indexOf(Marker.OPEN_ROUND_BRACKET) > -1 ?
|
||||
match.substring(0, match.indexOf(Marker.OPEN_ROUND_BRACKET)) :
|
||||
match;
|
||||
name = match.indexOf(Marker.OPEN_ROUND_BRACKET) > -1
|
||||
? match.substring(0, match.indexOf(Marker.OPEN_ROUND_BRACKET))
|
||||
: match;
|
||||
|
||||
if (mergeablePseudoClasses.indexOf(name) === -1 && mergeablePseudoElements.indexOf(name) === -1) {
|
||||
return false;
|
||||
@@ -180,9 +187,9 @@ function needArguments(matches) {
|
||||
|
||||
bracketOpensAt = match.indexOf(Marker.OPEN_ROUND_BRACKET);
|
||||
hasArguments = bracketOpensAt > -1;
|
||||
name = hasArguments ?
|
||||
match.substring(0, bracketOpensAt) :
|
||||
match;
|
||||
name = hasArguments
|
||||
? match.substring(0, bracketOpensAt)
|
||||
: match;
|
||||
|
||||
if (hasArguments && PSEUDO_CLASSES_WITH_ARGUMENTS.indexOf(name) == -1) {
|
||||
return false;
|
||||
@@ -221,12 +228,12 @@ function someIncorrectlyChained(selector, matches) {
|
||||
areChained = matchAt + match.length == nextMatchAt;
|
||||
|
||||
if (areChained) {
|
||||
name = match.indexOf(Marker.OPEN_ROUND_BRACKET) > -1 ?
|
||||
match.substring(0, match.indexOf(Marker.OPEN_ROUND_BRACKET)) :
|
||||
match;
|
||||
nextName = nextMatch.indexOf(Marker.OPEN_ROUND_BRACKET) > -1 ?
|
||||
nextMatch.substring(0, nextMatch.indexOf(Marker.OPEN_ROUND_BRACKET)) :
|
||||
nextMatch;
|
||||
name = match.indexOf(Marker.OPEN_ROUND_BRACKET) > -1
|
||||
? match.substring(0, match.indexOf(Marker.OPEN_ROUND_BRACKET))
|
||||
: match;
|
||||
nextName = nextMatch.indexOf(Marker.OPEN_ROUND_BRACKET) > -1
|
||||
? nextMatch.substring(0, nextMatch.indexOf(Marker.OPEN_ROUND_BRACKET))
|
||||
: nextMatch;
|
||||
|
||||
if (name != NOT_PSEUDO || nextName != NOT_PSEUDO) {
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user