ampproject / ampproject/amp-toolbox-php
[Feature] Support writting custom transformers using Dom\HTMLDocument
- Dominant language
- PHP
- Stars
- 74
- Forks
- 25
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 3
Description
The class `AmpProject\Dom\Document` used in the method `AmpProject\Optimizer\Transformer::transform` when writting custom transformers extends the old DOMDocument. Since php 8.4 we have [HTML5 support](https://www.php.net/releases/8.4/en.php#dom_additions_html5) via `Dom\HTMLDocument` with new useful methods like `querySelector` or `querySelectorAll` but we cannot use them yet with transformers.
Maybe adding a new interface?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with AmpProject\Dom\Document and the AmpProject\Optimizer\Transformer::transform method to understand how custom transformers receive and use the document. Review the existing transformer interface and PHP version compatibility requirements, then define the smallest supported approach that lets custom transformers use Dom\HTMLDocument methods without breaking existing transformers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100