PluginProbe
xSpeed Cache: AI-Powered Performance Hub with MCP, Caching & CDN / 1.3.7
xSpeed Cache: AI-Powered Performance Hub with MCP, Caching & CDN v1.3.7
1.3.7 1.3.6 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 All 33 releases
← All changes | includes/class-css-combine-buffer.php +19 -2 1.3.2 → 1.3.7 View file →
@@ -454,10 +454,27 @@
454 454 // and says the same thing: this sheet is parked under `print` and
455 455 // becomes something else on load. Any plugin using the standard
456 456 // print/swap idiom is read correctly rather than merged into a
457 457 // print-only bundle and stripped of its handler (#335 review, issue 3).
458 - if ( preg_match( '#\bonload\s*=\s*(["\'])\s*this\.media\s*=\s*(["\'])([^"\']*)\2#i', $tag, $m ) ) {
459 - return $m[3];
458 + //
459 + // The assignment can sit anywhere in the handler. loadCSS spells it
460 + // `this.onload=null;this.media='all'`, and matching only a handler
461 + // that STARTS with `this.media` filed two such sheets as real print
462 + // sheets: merged into a `media="print"` bundle with no onload, they
463 + // never applied on screen. (#560)
464 + //
465 + // The attribute is decoded first: a tag built with esc_attr() carries
466 + // `this.media='all'`. An assignment whose value is not a
467 + // literal (`this.media=this.dataset.media`) is still a swap; it
468 + // restores to the screen, so it is read as `all`.
469 + if ( preg_match( '#(?<![-\w])onload\s*=\s*(?:"([^"]*)"|\'([^\']*)\')#i', $tag, $h ) ) {
470 + $handler = html_entity_decode( '' !== $h[1] ? $h[1] : ( $h[2] ?? '' ), ENT_QUOTES | ENT_HTML5, 'UTF-8' );
471 + if ( preg_match( '#\bthis\.media\s*=\s*(["\'])([^"\']*)\1#i', $handler, $m ) ) {
472 + return $m[2];
473 + }
474 + if ( preg_match( '#\bthis\.media\s*=(?!=)#i', $handler ) ) {
475 + return 'all';
476 + }
460 477 }
461 478
462 479 return '';
463 480 }