PluginProbe
xSpeed Cache: AI-Powered Performance Hub with MCP, Caching & CDN / 1.3.5
xSpeed Cache: AI-Powered Performance Hub with MCP, Caching & CDN v1.3.5
1.3.5 1.3.4 1.3.3 1.3.2 1.3.1 1.3.0 1.2.4 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 All 31 releases
← All changes | includes/modules/Lazy/LazyModule.php +20 -4 1.3.01.3.5 View file →
@@ -185,8 +185,14 @@
185 185 // renders isn't known until the content filter has run — long
186 186 // after wp_head — and a layout rule that arrives in the footer
187 187 // fixes the gap only after the visitor has already seen it.
188 188 add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_facade_style' ) );
189 + // Embeds that never touch the HTML: a builder widget builds its
190 + // YouTube iframe from script, so the buffer pass has nothing to
191 + // rewrite. Head, priority 1, for the same reason as the autoplay
192 + // restorer below — it must be listening before the widget's
193 + // script sets a src and commits the fetch.
194 + add_action( 'wp_head', array( $this, 'print_observer_script' ), 1 );
189 195 }
190 196
191 197 // Same conditional-footer treatment for the autoplay restorer: it is
192 198 // only printed on a response that actually deferred one.
@@ -226,13 +232,23 @@
226 232 * Emit the click-to-play handler inline. Inline (not enqueued) because
227 233 * it is ~400 bytes — a separate request would cost more than the code.
228 234 */
229 235 public function print_facade_script(): void {
230 - if ( ! Lazy_Loader::facade_used() ) {
231 - return;
232 - }
236 + // No longer gated on facade_used(): the observer script can build a
237 + // facade for a JS-injected embed on a page where the server pass
238 + // rendered none, and a facade without its click handler is a play
239 + // button that plays nothing. ~400 bytes on facade-less pages is the
240 + // cost of never shipping that.
241 + wp_print_inline_script_tag( \XSpeed\Video_Facade::facade_script(), array( 'id' => 'xspeed-video-facade' ) );
242 + }
233 243
234 - wp_print_inline_script_tag( \XSpeed\Video_Facade::facade_script(), array( 'id' => 'xspeed-video-facade' ) );
244 + /**
245 + * Emit the interceptor for JS-injected embeds (see
246 + * Video_Facade::observer_script() for the mechanism and why the
247 + * footer is too late).
248 + */
249 + public function print_observer_script(): void {
250 + wp_print_inline_script_tag( \XSpeed\Video_Facade::observer_script(), array( 'id' => 'xspeed-video-facade-observer' ) );
235 251 }
236 252
237 253 /**
238 254 * Emit the viewport restorer for deferred AUTOPLAY videos.