Skip to content
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

Avoid preloading empty href attributes with Optimize critical images #7116

Open
camilamadronero opened this issue Nov 18, 2024 · 0 comments
Open

Comments

@camilamadronero
Copy link

Describe the bug
The Optimize critical images feature adds a preload tag for empty href values.

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://neo.law/ or any site with a markup such as <div style="background-image:url();"></div> as a markup for LCP element.
  2. Run Optimize critical images on it.
  3. See the resulting preload markup: <link rel="preload" data-rocket-preload as="image" href="" fetchpriority="high">

Expected behavior
Optimize critical images should avoid adding a preload tag in these conditions.

Screenshots
Original markup: https://jmp.sh/34iunv8H
Preload tag: https://jmp.sh/y6BkzWZq

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Ticket: https://secure.helpscout.net/conversation/2762969880/523284?viewId=273761
Slack thread: https://wp-media.slack.com/archives/C072P5EU5DF/p1731706632758679

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant