| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
…or Embed Optimizer
Codecov ReportAll modified and coverable lines are covered by tests ✅ Additional details and impacted files @@ Coverage Diff @@
## trunk #1908 +/- ##
=======================================
Coverage 69.63% 69.63%
=======================================
Files 86 86
Lines 6991 6991
=======================================
Hits 4868 4868
Misses 2123 2123
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry.
|
Sorry, something went wrong.
|
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 <westonruter@git.wordpress.org> Co-authored-by: felixarntz <flixos90@git.wordpress.org> To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Sorry, something went wrong.
| // As of 1.0.0-beta3, next_tag() allows $query and is beginning to migrate to skip tag closers by default. | ||
| // In versions prior to this, the method always visited closers and passing a $query actually threw an exception. | ||
| $tag_query = version_compare( OPTIMIZATION_DETECTIVE_VERSION, '1.0.0-beta3', '>=' ) | ||
| $tag_query = ! defined( 'OPTIMIZATION_DETECTIVE_VERSION' ) || version_compare( OPTIMIZATION_DETECTIVE_VERSION, '1.0.0-beta3', '>=' ) |
There was a problem hiding this comment.
Why is this function's logic running even when Optimization Detective is not active? Is it not something that relies on that plugin?
Also, looking at this again: Why does the Optimization Detective matter for this, given it's passed to the WP_HTML_Tag_Processor instance, which should depend on Core, not OD? Maybe I'm missing something here.
Sorry, something went wrong.
There was a problem hiding this comment.
Embed Optimizer does not require Optimization Detective. Without Optimization Detective, it lazy-loads all embeds.
When OD is not active, a WP_HTML_Tag_Processor instance is passed. When OD is active, then an OD_HTML_Tag_Processor instance is passed (a subclass of WP_HTML_Tag_Processor).
Sorry, something went wrong.
There was a problem hiding this comment.
Makes sense, thanks.
I didn't know Embed Optimizer was doing this already on its own (albeit less reliably of course).
Sorry, something went wrong.
There was a problem hiding this comment.
I'm just realizing that this change and #1872 probably fix Embed Optimizer to work properly when OD is not active, actually. Because the default behavior of next_tag() is to not visit tag closers, and yet the OD subclass was visiting tag closers by default... since no query was being passed in, when OD is not active then it would be skipping all tag closers and the logic that checks $processor->is_tag_closer() would always return false.
Sorry, something went wrong.
There was a problem hiding this comment.
Nevermind. The only part of the code that uses is_tag_closer() is for the non-OD context:
performance/plugins/embed-optimizer/hooks.php
Lines 212 to 234 in 20fea77
So there wouldn't have been a bug.
Sorry, something went wrong.
There was a problem hiding this comment.
Thanks, LGTM!
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
I was doing some testing with Optimization Detective deactivated but with Embed Optimizer active. I started getting a fatal error:
This issue was introduced in #1872. It is an issue unique to Embed Optimizer because it does not require Optimization Detective but merely suggests it. This means the OPTIMIZATION_DETECTIVE_VERSION constant is not guaranteed to be defined. It's not needed by Image Prioritizer since it initializes at the od_init action so we guaranteed that the constant will be available.