Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Parser.php

function Parser::parseElementNode

1 call to Parser::parseElementNode()
Parser::parseSimpleSelector in vendor/symfony/css-selector/Parser/Parser.php
Parses next simple node (hash, class, pseudo, negation).

File

vendor/symfony/css-selector/Parser/Parser.php, line 295

Class

Parser
CSS selector parser.

Namespace

Symfony\Component\CssSelector\Parser

Code

private function parseElementNode(TokenStream $stream) : Node\ElementNode {
    $peek = $stream->getPeek();
    if ($peek->isIdentifier() || $peek->isDelimiter([
        '*',
    ])) {
        if ($peek->isIdentifier()) {
            $namespace = $stream->getNext()
                ->getValue();
        }
        else {
            $stream->getNext();
            $namespace = null;
        }
        if ($stream->getPeek()
            ->isDelimiter([
            '|',
        ])) {
            $stream->getNext();
            $element = $stream->getNextIdentifierOrStar();
        }
        else {
            $element = $namespace;
            $namespace = null;
        }
    }
    else {
        $element = $namespace = null;
    }
    return new Node\ElementNode($namespace, $element);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal