diff options
| author | 2024-09-06 09:11:37 +0200 | |
|---|---|---|
| committer | 2024-09-06 09:11:37 +0200 | |
| commit | 9f4f6e9cac6c20257ff496c28a02dd9463c6cdcb (patch) | |
| tree | b0e4ed9be545841d30458cfe31b0c0aa4828260f /lib/phpgt/cssxpath/README.md | |
| parent | a81656c3ed5b8fe0f31794a4fbe0d1a907fca8e8 (diff) | |
Bump phpgt/cssxpath (#6618)
Includes https://github.com/PhpGt/CssXPath/pull/227
Follow-up of https://github.com/PhpGt/CssXPath/pull/227 for PHP 8.4
Requires PHP 8.0+
Full diff https://github.com/PhpGt/CssXPath/compare/d99d35f7194bac19fb3f8726b70c1bc83de3e931...45f3ac151fc21d459e2515c3aff97cd4bf877bf8
Diffstat (limited to 'lib/phpgt/cssxpath/README.md')
| -rw-r--r-- | lib/phpgt/cssxpath/README.md | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/phpgt/cssxpath/README.md b/lib/phpgt/cssxpath/README.md index 8dfeabc42..048547442 100644 --- a/lib/phpgt/cssxpath/README.md +++ b/lib/phpgt/cssxpath/README.md @@ -8,10 +8,10 @@ A lightweight and dependency free CSS to XPath translator. This repository is us <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"> +<a href="https://app.codacy.com/gh/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"> +<a href="https://app.codecov.io/gh/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"> @@ -49,5 +49,15 @@ $xpath = new DOMXPath($document); $inputElementList = $xpath->query(new Translator("form>label>input"); ``` +## Using this library with XML Documents + +To correctly work with XML documents, where the attributes are case-sensitive, pass `false` to the `htmlMode` property of the constructor. + +```php +$translator = new Translator("[data-FOO='bar']", htmlMode: false); +``` + +It's perhaps worth noting that for XML-style matching to work, you must load the document content with DOMDocument->load/DOMDocument->loadXML instead of DOMDocument->loadHTMLFile/DOMDocument->loadHTML, as the HTML loading methods automatically convert the tags and attribute names to lowercase. This is handled automatically when using [PHP.Gt/Dom][gt-dom]. + [qsa]: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll [gt-dom]: https://www.php.gt/dom |
