Skip to content

Boost: Ensure LCP Image comparison ignores HTML encoding #43658

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: trunk
Choose a base branch
from

Conversation

LiamSarsfield
Copy link
Contributor

@LiamSarsfield LiamSarsfield commented May 28, 2025

Fixes HOG-124: Make LCP optimization and Image CDN play nice with each other

Proposed changes:

  • Ensures that the image HTML from the $buffer and the HTML from the Cloud are compared with the same appropriate characters.

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

Does this pull request change what data or activity we track or use?

Testing instructions:

Prerequisites:

  • Ensure https://github.com/Automattic/boost-cloud/pull/688 is checked out within Boost Cloud
  • Latest Jetpack Boost Developer plugin installed and activated.
  • Your local Boost Cloud is connected to your local WP instance.
  • At least one Cornerstone Page set.
  • Boost Feature Flag enabled within the install (JETPACK_BOOST_ALPHA_FEATURES)
  • LCP Optimization feature enabled.
  • Image CDN is enabled.

Instructions

  1. Optimize the LCP, and wait for it to be completed.
  2. Visit the optimized page
  3. Check that the LCP image receives the LCP optimization attributes, such as:
    • fetchpriority="high"
    • loading="eager"
  4. Inspect the network tab to ensure Image CDN URLs are applied
  5. Before this fix: LCP images with HTML entity differences would not be matched and optimized.
  6. After this fix: LCP images are properly matched and optimized regardless of HTML entity encoding variations.

…uffer comparison. This ensures accurate detection of the LCP HTML in various formats.
@github-actions github-actions bot added [Boost Feature] Lcp [Plugin] Boost A feature to speed up the site and improve performance. [Status] In Progress labels May 28, 2025
Copy link
Contributor

github-actions bot commented May 28, 2025

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add a "[Type]" label (Bug, Enhancement, Janitorial, Task).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!


Boost plugin:

  • Next scheduled release: May 29, 2025

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@github-actions github-actions bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label May 28, 2025
@LiamSarsfield LiamSarsfield added the [Type] Bug When a feature is broken and / or not performing as intended label May 28, 2025
Copy link

Code Coverage Summary

Coverage changed in 1 file.

File Coverage Δ% Δ Uncovered
projects/plugins/boost/app/modules/optimizations/lcp/class-lcp-optimize-img-tag.php 0/82 (0.00%) 0.00% 3 ❤️‍🩹

Full summary · PHP report · JS report

@LiamSarsfield LiamSarsfield removed the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label May 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Boost Feature] Lcp [Plugin] Boost A feature to speed up the site and improve performance. [Status] In Progress [Type] Bug When a feature is broken and / or not performing as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant