drupal/core/vendor/symfony/css-selector
Alex Pott b65b47289f Issue #2504967 by hussainweb, joshtaylor, jibran, Berdir: Upgrade to Symfony 2.7.1 2015-07-13 13:49:14 +01:00
..
Exception Issue #2470693 by dawehner, Berdir, jibran, hussainweb, pwolanin, znerol: Upgrade to Symfony 2.7.0 2015-06-01 11:47:08 +01:00
Node Issue #2470693 by dawehner, Berdir, jibran, hussainweb, pwolanin, znerol: Upgrade to Symfony 2.7.0 2015-06-01 11:47:08 +01:00
Parser Issue #2470693 by dawehner, Berdir, jibran, hussainweb, pwolanin, znerol: Upgrade to Symfony 2.7.0 2015-06-01 11:47:08 +01:00
Tests Issue #2470693 by dawehner, Berdir, jibran, hussainweb, pwolanin, znerol: Upgrade to Symfony 2.7.0 2015-06-01 11:47:08 +01:00
XPath Issue #2470693 by dawehner, Berdir, jibran, hussainweb, pwolanin, znerol: Upgrade to Symfony 2.7.0 2015-06-01 11:47:08 +01:00
.gitignore Issue #2504967 by hussainweb, joshtaylor, jibran, Berdir: Upgrade to Symfony 2.7.1 2015-07-13 13:49:14 +01:00
CHANGELOG.md Issue #2470693 by dawehner, Berdir, jibran, hussainweb, pwolanin, znerol: Upgrade to Symfony 2.7.0 2015-06-01 11:47:08 +01:00
CssSelector.php Issue #2470693 by dawehner, Berdir, jibran, hussainweb, pwolanin, znerol: Upgrade to Symfony 2.7.0 2015-06-01 11:47:08 +01:00
LICENSE Issue #2470693 by dawehner, Berdir, jibran, hussainweb, pwolanin, znerol: Upgrade to Symfony 2.7.0 2015-06-01 11:47:08 +01:00
README.md Issue #2470693 by dawehner, Berdir, jibran, hussainweb, pwolanin, znerol: Upgrade to Symfony 2.7.0 2015-06-01 11:47:08 +01:00
composer.json Issue #2470693 by dawehner, Berdir, jibran, hussainweb, pwolanin, znerol: Upgrade to Symfony 2.7.0 2015-06-01 11:47:08 +01:00
phpunit.xml.dist Issue #2470693 by dawehner, Berdir, jibran, hussainweb, pwolanin, znerol: Upgrade to Symfony 2.7.0 2015-06-01 11:47:08 +01:00

README.md

CssSelector Component

CssSelector converts CSS selectors to XPath expressions.

The component only goal is to convert CSS selectors to their XPath equivalents:

use Symfony\Component\CssSelector\CssSelector;

print CssSelector::toXPath('div.item > h4 > a');

HTML and XML are different

The CssSelector component comes with an HTML extension which is enabled by default. If you need to use this component with XML documents, you have to disable this HTML extension. That's because, HTML tag & attribute names are always lower-cased, but case-sensitive in XML:

// disable `HTML` extension:
CssSelector::disableHtmlExtension();

// re-enable `HTML` extension:
CssSelector::enableHtmlExtension();

When the HTML extension is enabled, tag names are lower-cased, attribute names are lower-cased, the following extra pseudo-classes are supported: checked, link, disabled, enabled, selected, invalid, hover, visited, and the lang() function is also added.

Resources

This component is a port of the Python cssselect library v0.7.1, which is distributed under the BSD license.

You can run the unit tests with the following command:

$ cd path/to/Symfony/Component/CssSelector/
$ composer install
$ phpunit