Automattic\WooCommerce\Vendor\Pelago\Emogrifier

CssInliner::existsMatchForCssSelectorprivateWC 1.0

Checks whether there is at least one matching element for $cssSelector. When not in debug mode, it returns true also for invalid selectors (because they may be valid, just not implemented/recognized yet by Emogrifier).

Method of the class: CssInliner{}

No Hooks.

Returns

true|false.

Usage

// private - for code of main (parent) class only
$result = $this->existsMatchForCssSelector( $cssSelector ): bool;
$cssSelector(string) (required)
.

CssInliner::existsMatchForCssSelector() code WC 10.4.3

private function existsMatchForCssSelector(string $cssSelector): bool
{
    try {
        $nodesMatchingSelector
            = $this->querySelectorAll($cssSelector, [self::QSA_ALWAYS_THROW_PARSE_EXCEPTION => true]);
    } catch (ParseException $e) {
        if ($this->debug) {
            throw $e;
        }
        return true;
    }

    return $nodesMatchingSelector->length !== 0;
}