Automattic\WooCommerce\Vendor\Pelago\Emogrifier\Css

CssDocument::__constructpublicWC 1.0

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

Хуков нет.

Возвращает

null. Ничего (null).

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

$CssDocument = new CssDocument();
$CssDocument->__construct( $css, $debug );
$css(строка) (обязательный)
.
$debug(true|false) (обязательный)
If this is true, an exception will be thrown if invalid CSS is encountered. Otherwise the parser will try to do the best it can.

Код CssDocument::__construct() WC 11.0.1

public function __construct(string $css, bool $debug)
{
    // CSS Parser currently throws exception with nested at-rules (like `@media`) in strict parsing mode
    $parserSettings = ParserSettings::create()->withLenientParsing(!$debug || $this->hasNestedAtRule($css));

    // CSS Parser currently throws exception with non-empty whitespace-only CSS in strict parsing mode, so `trim()`
    // @see https://github.com/sabberworm/PHP-CSS-Parser/issues/349
    $this->sabberwormCssDocument = (new CssParser(\trim($css), $parserSettings))->parse();
}