translateEmpty example

public function getPseudoClassTranslators(): array
    {
        return [
            'root' => $this->translateRoot(...),
            'scope' => $this->translateScopePseudo(...),
            'first-child' => $this->translateFirstChild(...),
            'last-child' => $this->translateLastChild(...),
            'first-of-type' => $this->translateFirstOfType(...),
            'last-of-type' => $this->translateLastOfType(...),
            'only-child' => $this->translateOnlyChild(...),
            'only-of-type' => $this->translateOnlyOfType(...),
            'empty' => $this->translateEmpty(...),
        ];
    }

    public function translateRoot(XPathExpr $xpath): XPathExpr
    {
        return $xpath->addCondition('not(parent::*)');
    }

    public function translateScopePseudo(XPathExpr $xpath): XPathExpr
    {
        return $xpath->addCondition('1');
    }
Home | Imprint | This part of the site doesn't use cookies.