WordPress at a glance
function is not described


CssInliner::removeUnmatchablePseudoComponents() private WC 1.0

Removes pseudo-elements and dynamic pseudo-classes from a CSS selector, replacing them with "*" if necessary. If such a pseudo-component is within the argument of :not, the entire :not component is removed or replaced.

{} It's a method of the class: CssInliner{}

No Hooks.


String. Selector which will match the relevant DOM elements if the pseudo-classes are assumed to apply, or in the case of pseudo-elements will match their originating element.


// private - for code of main (parent) class only
$result = $this->removeUnmatchablePseudoComponents( $selector );
$selector(string) (required)

Code of CssInliner::removeUnmatchablePseudoComponents() WC 5.0.0

private function removeUnmatchablePseudoComponents($selector)
    // The regex allows nested brackets via `(?2)`.
    // A space is temporarily prepended because the callback can't determine if the match was at the very start.
    $selectorWithoutNots = \ltrim(\preg_replace_callback(
        [$this, 'replaceUnmatchableNotComponent'],
        ' ' . $selector

    $pseudoComponentMatcher = ':(?!' . self::PSEUDO_CLASS_MATCHER . '):?+[\\w\\-]++(?:\\([^\\)]*+\\))?+';
    return \preg_replace(
        ['/(\\s|^)' . $pseudoComponentMatcher . '/i', '/' . $pseudoComponentMatcher . '/i'],
        ['$1*', ''],