From 9f4f6e9cac6c20257ff496c28a02dd9463c6cdcb Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Fri, 6 Sep 2024 09:11:37 +0200 Subject: 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 --- lib/phpgt/cssxpath/README.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'lib/phpgt/cssxpath/README.md') 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 Build status - + Code quality - + Code coverage @@ -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 -- cgit v1.2.3