Skip to content

[DomCrawler] Leverage PHP 8.4 DOM addition of native query selectors #57605

Open
@alexandre-daubois

Description

@alexandre-daubois

Description

Support for native HTML5 parser is being added to DomCrawler.

Lately, a lot of great additions are being added to the new DOM extension, especially query selectors : https://wiki.php.net/rfc/dom_additions_84 (it's the first section of the RFC).

DomCrawler could definitely benefit from this. At this time, the component is using CssSelector (the dependency is in the require-dev section currently). It would be nice to leverage this new native feature also when available !

I think it is not a good idea to bring support right now in the WIP PR, it is already kind of huge and complex, and we should do this step by step. For the record, the patch was merged in the engine upstream already: php/php-src#13819.

I'm creating this issue so we don't forget about it 😄 Indeed related to #53666

Example

The Crawler API wouldn't change, but internals of Crawler::matches, Crawler::closest() and alike would leverage the new native API.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions