Automattic\WooCommerce\Vendor\Pelago\Emogrifier

CssInliner::hasUnsupportedPseudoClassprivateWC 1.0

Tests if a selector contains a pseudo-class which would mean it cannot be converted to an XPath expression for inlining CSS declarations.

Any pseudo class that does not match {@see PSEUDO_CLASS_MATCHER} cannot be converted. Additionally, ...of-type pseudo-classes cannot be converted if they are not associated with a type selector.

Метод класса: CssInliner{}

Хуков нет.

Возвращает

bool.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->hasUnsupportedPseudoClass( $selector ): bool;
$selector(строка) (обязательный)
.

Код CssInliner::hasUnsupportedPseudoClass() WC 11.1.1

private function hasUnsupportedPseudoClass(string $selector): bool
{
    $preg = (new Preg())->throwExceptions($this->debug);

    if ($preg->match('/:(?!' . self::PSEUDO_CLASS_MATCHER . ')[\\w\\-]/i', $selector) !== 0) {
        return true;
    }

    if ($preg->match('/:(?:' . self::OF_TYPE_PSEUDO_CLASS_MATCHER . ')/i', $selector) === 0) {
        return false;
    }

    foreach ($preg->split('/' . self::COMBINATOR_MATCHER . '/', $selector) as $selectorPart) {
        if ($this->selectorPartHasUnsupportedOfTypePseudoClass($selectorPart)) {
            return true;
        }
    }

    return false;
}