class 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>
@internal
Hierarchy
- class \Symfony\Component\CssSelector\Node\AbstractNode implements \Symfony\Component\CssSelector\Node\NodeInterface
- class \Symfony\Component\CssSelector\Node\SelectorNode extends \Symfony\Component\CssSelector\Node\AbstractNode
Expanded class hierarchy of SelectorNode
See also
https://github.com/SimonSapin/cssselect.
7 files declare their use of SelectorNode
- ClassParser.php in vendor/
symfony/ css-selector/ Parser/ Shortcut/ ClassParser.php - ElementParser.php in vendor/
symfony/ css-selector/ Parser/ Shortcut/ ElementParser.php - EmptyStringParser.php in vendor/
symfony/ css-selector/ Parser/ Shortcut/ EmptyStringParser.php - HashParser.php in vendor/
symfony/ css-selector/ Parser/ Shortcut/ HashParser.php - ParserInterface.php in vendor/
symfony/ css-selector/ Parser/ ParserInterface.php
File
-
vendor/
symfony/ css-selector/ Node/ SelectorNode.php, line 24
Namespace
Symfony\Component\CssSelector\NodeView source
class SelectorNode extends AbstractNode {
private ?string $pseudoElement;
public function __construct(NodeInterface $tree, ?string $pseudoElement = null) {
$this->pseudoElement = $pseudoElement ? strtolower($pseudoElement) : null;
}
public function getTree() : NodeInterface {
return $this->tree;
}
public function getPseudoElement() : ?string {
return $this->pseudoElement;
}
public function getSpecificity() : Specificity {
return $this->tree
->getSpecificity()
->plus(new Specificity(0, 0, $this->pseudoElement ? 1 : 0));
}
public function __toString() : string {
return \sprintf('%s[%s%s]', $this->getNodeName(), $this->tree, $this->pseudoElement ? '::' . $this->pseudoElement : '');
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
---|---|---|---|---|
AbstractNode::$nodeName | private | property | ||
AbstractNode::getNodeName | public | function | Overrides NodeInterface::getNodeName | |
SelectorNode::$pseudoElement | private | property | ||
SelectorNode::getPseudoElement | public | function | ||
SelectorNode::getSpecificity | public | function | Overrides NodeInterface::getSpecificity | |
SelectorNode::getTree | public | function | ||
SelectorNode::__construct | public | function | ||
SelectorNode::__toString | public | function |