Automattic\WooCommerce\Vendor\Pelago\Emogrifier

CssInliner::replaceUnmatchableNotComponent │ private │ WC 1.0

Helps removeUnmatchablePseudoComponents() replace or remove a selector :not(...) component if its argument contains pseudo-elements or dynamic pseudo-classes.

Method of the class: CssInliner{}

No Hooks.

Returns

string. the full match if there were no unmatchable pseudo components within; otherwise, any preceding combinator followed by "*", or an empty string if there was no preceding combinator

Usage

// private - for code of main (parent) class only
$result = $this->replaceUnmatchableNotComponent( $matches ): string;
$matches(array<array-key, string>) (required)
array of elements matched by the regular expression.

CssInliner::replaceUnmatchableNotComponent() code WC 11.1.2

private function replaceUnmatchableNotComponent(array $matches): string
{
    [$notComponentWithAnyPrecedingCombinator, $anyPrecedingCombinator, $notArgumentInBrackets] = $matches;

    if ($this->hasUnsupportedPseudoClass($notArgumentInBrackets)) {
        return $anyPrecedingCombinator !== '' ? $anyPrecedingCombinator . '*' : '';
    }
    return $notComponentWithAnyPrecedingCombinator;
}