This release introduces the newly refactored code, which has unlocked the possibility to implement two missing pseudo selectors: :has and :not. Thanks to @reaganch for the feature request that came in just at the right time.
Full Changelog: https://github.com/phpgt/CssXPath/compare/v1.4.0...v1.5.0
Full Changelog: https://github.com/phpgt/CssXPath/compare/v1.3.0...v1.4.0
Full Changelog: https://github.com/PhpGt/CssXPath/compare/v1.2.0...v1.2.1
Full Changelog: https://github.com/PhpGt/CssXPath/compare/v1.1.4...v1.2.0
Backwards compatibility is added in this release to allow PHP.Gt/Dom v2 to retain compatibility with PHP 7.3
This minor patch release includes the switch from Circle CI to Github Actions along with a few improvements to how types are hinted, for static analysis improvement.
When using continue within switch statements, special care has to be taken to ensure the loops are continued as expected. This release removes ambiguity by specifying the continue nesting argument.
From https://www.php.net/manual/en/control-structures.continue.php :
Note: In PHP the switch statement is considered a looping structure for the purposes of continue. continue behaves like break (when no arguments are passed). If a switch is inside a loop, continue 2 will continue with the next iteration of the outer loop.
This release contains a number of bugfixes:
Multiple CSS selectors can be present within the same query like this: div>a, div>li>a, and a simple explode() was being called to split the strings. However, this caused an issue when one selector was looking for an attribute selector whose value contained a comma.
To solve this, a regular expression has been used to split only commas that are not surrounded by quotes.
With the push to release PhpGt repositories to their stable versions, this release includes the single piece of functionality that was holding it back from being integrated within WebEngine: the ability to assign a prefix to the XPath query.
This is used within the PhpGt/Dom repository to allow typical child-based searches, but also parent-based searches for using DOM functionality such as $element->closest($selector).
The library has been in use within WebEngine for a number of weeks so is receiving its first stable release, and even though advanced functionality like :not selector is missing right now (and admittedly, doing advanced CSS selectors within your server-side code is probably a bad idea), we're looking forward to adding more completeness to the library for future releases.
Have fun and stay productive!
Part of the CSS specification is the ability to match multiple selectors as one, separated by a comma. This has now been implemented in this repository by splitting the input string on a comma and converting to multiple XPath queries that are chainable.
Amongst this feature, unit tests and continuous integration platforms have been upgraded to the latest versions, and unit tests have been hardened.
Multiple class selectors can now be chained together, fixing a known bug. Classes are now normalised on entry to fix some false positives.
Because of the reliance on Symfony's CSS selector package, it's very important to test real-world use cases of CSS selectors.
It is not greatly important to get to full CSS-spec for v1 release, because there are so many complex selectors that just shouldn't be performed on the server, but getting 100% test coverage is a must.
Currently at 68%!
This first pre-release has achieved the initial goal of passing the original tests for semi-complex CSS selector translation.
There are some edge cases to work through and when more complex tests are written we will surely find some room for improvement, but for now this is 233 lines of minimal code to do the same thing as the massive dependency WebEngine currently has.
We will soon be refactoring the Translator into its own classes of functionality, which will aim the project towards a stable release.
How can I help you explore Laravel packages today?