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

Breadcrumb

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

function CssSelectorConverter::toXPath

Translates a CSS expression to its XPath equivalent.

Optionally, a prefix can be added to the resulting XPath expression with the $prefix parameter.

File

vendor/symfony/css-selector/CssSelectorConverter.php, line 63

Class

CssSelectorConverter
CssSelectorConverter is the main entry point of the component and can convert CSS selectors to XPath expressions.

Namespace

Symfony\Component\CssSelector

Code

public function toXPath(string $cssExpr, string $prefix = 'descendant-or-self::') : string {
    return $this->cache[$prefix][$cssExpr] ??= $this->translator
        ->cssToXPath($cssExpr, $prefix);
}
RSS feed
Powered by Drupal