Automattic\WooCommerce\Vendor\Pelago\Emogrifier
CssInliner::hasUnsupportedPseudoClass
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.
Method of the class: CssInliner{}
No Hooks.
Returns
true|false.
Usage
// private - for code of main (parent) class only $result = $this->hasUnsupportedPseudoClass( $selector ): bool;
- $selector(string) (required)
- .
CssInliner::hasUnsupportedPseudoClass() CssInliner::hasUnsupportedPseudoClass code WC 10.4.3
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;
}