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

Skip visiting any tags inside of NOSCRIPT elements #1783

Merged
merged 2 commits into from
Jan 9, 2025

Conversation

westonruter
Copy link
Member

@westonruter westonruter commented Jan 9, 2025

Any tag which appears in a NOSCRIPT should always be excluded from visiting by any tag visitor. For example:

<noscript>
	<img decoding="async" src="https://example.com/pixel.gif" alt="" width="1" height="1">
</noscript>

Currently this shows up on pages as:

<noscript>
	<img data-od-unknown-tag src="https://example.com/pixel.gif" alt="" width="1" height="1">
</noscript>

Image Prioritizer adds the data-od-unknown-tag attribute to any visited tag IMG which is not located in URL Metrics. However, such an IMG can never be added to URL Metrics since it is not located in the DOM.

This PR skips over visiting any tag which is inside of a NOSCRIPT element.

Such NOSCRIPT tags are often found with JS-based lazy-loading implementations.

@westonruter westonruter added [Type] Bug An existing feature is broken [Plugin] Optimization Detective Issues for the Optimization Detective plugin [Plugin] Image Prioritizer Issues for the Image Prioritizer plugin (dependent on Optimization Detective) labels Jan 9, 2025
@westonruter westonruter added this to the image-prioritizer n.e.x.t milestone Jan 9, 2025
Copy link

github-actions bot commented Jan 9, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: westonruter <[email protected]>
Co-authored-by: felixarntz <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@westonruter westonruter changed the title Fix NOSCRIPT handling Skip visiting any tags inside of NOSCRIPT elements Jan 9, 2025
Copy link

codecov bot commented Jan 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 57.43%. Comparing base (4693bee) to head (14f57a8).
Report is 3 commits behind head on trunk.

Additional details and impacted files
@@            Coverage Diff             @@
##            trunk    #1783      +/-   ##
==========================================
+ Coverage   57.42%   57.43%   +0.01%     
==========================================
  Files          84       84              
  Lines        6506     6508       +2     
==========================================
+ Hits         3736     3738       +2     
  Misses       2770     2770              
Flag Coverage Δ
multisite 57.43% <100.00%> (+0.01%) ⬆️
single 34.46% <0.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@westonruter westonruter force-pushed the fix/od-noscript-handling branch from 285da50 to 14f57a8 Compare January 9, 2025 22:15
Copy link
Member

@felixarntz felixarntz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@westonruter Great catch!

@westonruter westonruter merged commit d656e11 into trunk Jan 9, 2025
14 checks passed
@westonruter westonruter deleted the fix/od-noscript-handling branch January 9, 2025 22:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Plugin] Image Prioritizer Issues for the Image Prioritizer plugin (dependent on Optimization Detective) [Plugin] Optimization Detective Issues for the Optimization Detective plugin [Type] Bug An existing feature is broken
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants