public static function CssSelector::toXPath in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/css-selector/CssSelector.php \Symfony\Component\CssSelector\CssSelector::toXPath()
Translates a CSS expression to its XPath equivalent. Optionally, a prefix can be added to the resulting XPath expression with the $prefix parameter.
Parameters
mixed $cssExpr The CSS expression.:
string $prefix An optional prefix for the XPath expression.:
Return value
string
6 calls to CssSelector::toXPath()
- AssertContentTrait::cssSelect in core/
modules/ simpletest/ src/ AssertContentTrait.php - Searches elements using a CSS selector in the raw content.
- Crawler::filter in vendor/
symfony/ dom-crawler/ Crawler.php - Filters the list of nodes with a CSS selector.
- CssSelector::translateToXPath in vendor/
behat/ mink/ src/ Selector/ CssSelector.php - Translates CSS into XPath.
- CssSelectorTest::testCssToXPath in vendor/
symfony/ css-selector/ Tests/ CssSelectorTest.php - CssSelectorTest::testCssToXPathWithoutPrefix in vendor/
symfony/ css-selector/ Tests/ CssSelectorTest.php - @dataProvider getCssToXPathWithoutPrefixTestData
File
- vendor/
symfony/ css-selector/ CssSelector.php, line 79
Class
- CssSelector
- CssSelector is the main entry point of the component and can convert CSS selectors to XPath expressions.
Namespace
Symfony\Component\CssSelectorCode
public static function toXPath($cssExpr, $prefix = 'descendant-or-self::') {
$translator = new Translator();
if (self::$html) {
$translator
->registerExtension(new HtmlExtension($translator));
}
$translator
->registerParserShortcut(new EmptyStringParser())
->registerParserShortcut(new ElementParser())
->registerParserShortcut(new ClassParser())
->registerParserShortcut(new HashParser());
return $translator
->cssToXPath($cssExpr, $prefix);
}