Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor ImageCDN parsing to rely on HTML API instead of RegExps (#32700
) * Refactor ImageCDN parsing to rely on HTML API instead of RegExps (#32700) The introduction of the HTML API into WordPress 6.2 offers a new method of matching and modifying HTML. In this patch we're replacing code that attempts to parse the input HTML and visit all images, then read and modify them based on the values of their attributes and computed Photon properties. In the previous code the `Image_CDN` class scanned the entire HTML document to generate a list of PREG image match objects, then iterated over those matches and performed string-replace operations on them. Now the class does a pass from start to finish, visting each image tag along the way, and making the appropriate modifications. Co-authored-by: Adnan Haque <[email protected]> Co-authored-by: Brandon Kraft <[email protected]> Co-authored-by: Jeremy Herve <[email protected]> Co-authored-by: Mark George <[email protected]> Co-authored-by: Osk <[email protected]> * Rearrange semantically equivalent test output to avoid false negatives. No `assertEquivalentMarkup` exists yet, so this gets around that without creating one. * Fix broken test * Remove unnecessary comment * Fix static analysis issues * Fix static analysis issue * Bump project version to 0.4.7-alpha * Fix project version --------- Co-authored-by: Adnan Haque <[email protected]> Co-authored-by: Brandon Kraft <[email protected]> Co-authored-by: Jeremy Herve <[email protected]> Co-authored-by: Mark George <[email protected]> Co-authored-by: Osk <[email protected]> Co-authored-by: Peter Petrov <[email protected]>
- Loading branch information