WordPress at a glance
class is not described

Symfony\Component\CssSelector\Node

SelectorNode{} WC 1.0

Represents a "<selector>(::|:)<pseudoElement>" node.

This component is a port of the Python cssselect library, which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.

No Hooks.

Return

null. Nothing.

Usage

$SelectorNode = new SelectorNode();
// use class methods

Methods

  1. __construct(NodeInterface $tree, $pseudoElement = null)
  2. __toString()
  3. getPseudoElement()
  4. getSpecificity()
  5. getTree()

Code of SelectorNode{} WC 5.3.0

<?php
class SelectorNode extends AbstractNode
{
    /**
     * @var NodeInterface
     */
    private $tree;

    /**
     * @var null|string
     */
    private $pseudoElement;

    /**
     * @param NodeInterface $tree
     * @param null|string   $pseudoElement
     */
    public function __construct(NodeInterface $tree, $pseudoElement = null)
    {
        $this->tree = $tree;
        $this->pseudoElement = $pseudoElement ? strtolower($pseudoElement) : null;
    }

    /**
     * @return NodeInterface
     */
    public function getTree()
    {
        return $this->tree;
    }

    /**
     * @return null|string
     */
    public function getPseudoElement()
    {
        return $this->pseudoElement;
    }

    /**
     * {@inheritdoc}
     */
    public function getSpecificity()
    {
        return $this->tree->getSpecificity()->plus(new Specificity(0, 0, $this->pseudoElement ? 1 : 0));
    }

    /**
     * {@inheritdoc}
     */
    public function __toString()
    {
        return sprintf('%s[%s%s]', $this->getNodeName(), $this->tree, $this->pseudoElement ? '::'.$this->pseudoElement : '');
    }
}