aboutsummaryrefslogtreecommitdiff
path: root/lib/phpgt/cssxpath/README.md
diff options
context:
space:
mode:
authorGravatar Artur Weigandt <Art4@users.noreply.github.com> 2022-05-16 12:04:43 +0200
committerGravatar GitHub <noreply@github.com> 2022-05-16 12:04:43 +0200
commitd6fd78b96837969dc36ff852a3288fd45f8f9e61 (patch)
tree74d5482fad307e0e62c751535298d1e7c8f1ee5b /lib/phpgt/cssxpath/README.md
parentffd1061850d73182d40126658a0e9dd7f28f646e (diff)
Allow CssXPath updates with composer (#4368)
* Install CssXPath with composer * Fix code style in tests * fix pathnames for tests and linting * add irrelevant files to .gitignore * Alphabetic order * let composer sort the packages alphabetically Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
Diffstat (limited to 'lib/phpgt/cssxpath/README.md')
-rw-r--r--lib/phpgt/cssxpath/README.md53
1 files changed, 53 insertions, 0 deletions
diff --git a/lib/phpgt/cssxpath/README.md b/lib/phpgt/cssxpath/README.md
new file mode 100644
index 000000000..9082c8bbf
--- /dev/null
+++ b/lib/phpgt/cssxpath/README.md
@@ -0,0 +1,53 @@
+Translate CSS selectors to XPath queries.
+=========================================
+
+A lightweight and dependency free CSS to XPath translator. This repository is used to bring modern DOM functionality like [`querySelectorAll()`][qsa] to PHP in the [PHP.Gt/Dom][gt-dom] project.
+
+***
+
+<a href="https://github.com/PhpGt/CssXPath/actions" target="_blank">
+ <img src="https://badge.status.php.gt/cssxpath-build.svg" alt="Build status" />
+</a>
+<a href="https://scrutinizer-ci.com/g/PhpGt/CssXPath" target="_blank">
+ <img src="https://badge.status.php.gt/cssxpath-quality.svg" alt="Code quality" />
+</a>
+<a href="https://scrutinizer-ci.com/g/PhpGt/CssXPath" target="_blank">
+ <img src="https://badge.status.php.gt/cssxpath-coverage.svg" alt="Code coverage" />
+</a>
+<a href="https://packagist.org/packages/PhpGt/CssXPath" target="_blank">
+ <img src="https://badge.status.php.gt/cssxpath-version.svg" alt="Current version" />
+</a>
+<a href="http://www.php.gt/cssxpath" target="_blank">
+ <img src="https://badge.status.php.gt/cssxpath-docs.svg" alt="PHP.Gt/CssXPath documentation" />
+</a>
+
+Example usage
+-------------
+
+
+```php
+use Gt\CssXPath\Translator;
+
+$html = <<<HTML
+<form>
+ <label>
+ Name
+ <input name="name" />
+ </label>
+ <label>
+ Code:
+ <input name="code" />
+ </label>
+ <button name="do" value="submit">Submit code</button>
+</form>
+HTML;
+
+$document = new DOMDocument();
+$document->loadHTML($html);
+
+$xpath = new DOMXPath($document);
+$inputElementList = $xpath->query(new Translator("form>label>input");
+```
+
+[qsa]: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll
+[gt-dom]: https://www.php.gt/dom