Skip to content

Use native DOM CSS selectors when available - #9050

Open
Elgeryy1 wants to merge 5 commits into
FreshRSS:edgefrom
Elgeryy1:agent/issue-6830-native-dom-selectors
Open

Elgeryy1 wants to merge 5 commits into
FreshRSS:edgefrom
Elgeryy1:agent/issue-6830-native-dom-selectors

Conversation

@Elgeryy1

Copy link
Copy Markdown
Contributor

Summary

  • Use PHP 8.4's native Dom\HTMLDocument CSS selector APIs when available.
  • Keep the existing PhpGt/CssXPath implementation for PHP 8.1–8.3.
  • Route entry extraction and content-filter selectors through the compatibility layer.

The legacy DOMDocument used today does not implement querySelectorAll(). The compatibility layer creates the modern HTML document only when the native APIs exist; otherwise it retains the current parser and CSS-to-XPath translation path.

Fixes #6830

Validation

  • Focused PHPUnit tests for native selectors, the legacy fallback, and entry filtering
  • PHPCS across the repository
  • PHPStan across the repository

@Elgeryy1
Elgeryy1 marked this pull request as ready for review July 16, 2026 10:02
@Inverle Inverle added System care Everything related to system care php Pull requests that update Php code Web Scraping labels Jul 21, 2026
@Inverle Inverle added this to the 1.30.0 milestone Jul 21, 2026
# Conflicts:
#	app/Models/Entry.php
@Elgeryy1

Copy link
Copy Markdown
Contributor Author

Resolved the merge conflict with current edge via normal merge commit ff0c540 (no rebase/force-push). The resolution keeps the native-selector implementation and preserves the newer no-match/no-content diagnostics from edge.

@Alkarex Alkarex modified the milestones: 1.30.0, 1.31.0 Aug 18, 2026
@Alkarex Alkarex modified the milestones: 1.31.0, 1.32.0 Nov 9, 2026
@Alkarex

Alkarex commented Nov 15, 2026

Copy link
Copy Markdown
Member

Thanks for the PR, and sorry for the delay (plenty of cybersecurity got in the way).
I made a more comprehensive implementation using an alternative approach. Review and tests welcome:

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

php Pull requests that update Php code System care Everything related to system care Web Scraping

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Take advantage of PHP 8.4+ native CSS selectors

3 participants