You are here

class SelectorNode in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/css-selector/Node/SelectorNode.php \Symfony\Component\CssSelector\Node\SelectorNode

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

This component is a port of the Python cssselect library, which is copyright Ian Bicking, @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>

Hierarchy

Expanded class hierarchy of SelectorNode

See also

https://github.com/SimonSapin/cssselect.

13 files declare their use of SelectorNode
ClassParser.php in vendor/symfony/css-selector/Parser/Shortcut/ClassParser.php
ClassParserTest.php in vendor/symfony/css-selector/Tests/Parser/Shortcut/ClassParserTest.php
ElementParser.php in vendor/symfony/css-selector/Parser/Shortcut/ElementParser.php
ElementParserTest.php in vendor/symfony/css-selector/Tests/Parser/Shortcut/ElementParserTest.php
EmptyStringParser.php in vendor/symfony/css-selector/Parser/Shortcut/EmptyStringParser.php

... See full list

File

vendor/symfony/css-selector/Node/SelectorNode.php, line 22

Namespace

Symfony\Component\CssSelector\Node
View source
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 : '');
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AbstractNode::$nodeName private property
AbstractNode::getNodeName public function Overrides NodeInterface::getNodeName
SelectorNode::$pseudoElement private property
SelectorNode::$tree private property
SelectorNode::getPseudoElement public function
SelectorNode::getSpecificity public function Returns node's specificity. Overrides NodeInterface::getSpecificity
SelectorNode::getTree public function
SelectorNode::__construct public function
SelectorNode::__toString public function Returns node's string representation. Overrides NodeInterface::__toString