Automattic\WooCommerce\Vendor\Pelago\Emogrifier

CssInliner::querySelectorAllprivateWC 1.0

Method of the class: CssInliner{}

No Hooks.

Returns

\DOMNodeList<\DOMNode>. the HTML elements that match the provided CSS $selectors

Usage

// private - for code of main (parent) class only
$result = $this->querySelectorAll( $selectors, $options ): \DOMNodeList;
$selectors(string) (required)
.
$options(array)
.
Default: []

CssInliner::querySelectorAll() code WC 10.5.0

private function querySelectorAll(string $selectors, array $options = []): \DOMNodeList
{
    try {
        $result = $this->getXPath()->query($this->getCssSelectorConverter()->toXPath($selectors));

        if ($result === false) {
            throw new \RuntimeException('query failed with selector \'' . $selectors . '\'', 1726533051);
        }

        return $result;
    } catch (ParseException $exception) {
        $alwaysThrowParseException = $options[self::QSA_ALWAYS_THROW_PARSE_EXCEPTION] ?? false;
        if ($this->debug || $alwaysThrowParseException) {
            throw $exception;
        }
        return new \DOMNodeList();
    } catch (\RuntimeException $exception) {
        if (
            $this->debug
        ) {
            throw $exception;
        }
        // `RuntimeException` indicates a bug in CssSelector so pass the message to the error handler.
        \trigger_error($exception->getMessage());
        return new \DOMNodeList();
    }
}