| @@ -112,8 +112,27 @@ | ||
| 112 | 112 | // so the src sweep above never sees them; this one parks an |
| 113 | 113 | // inline body that names a known third-party host. |
| 114 | 114 | add_filter( 'xspeed_cache_final_html', array( Minify_Filters::class, 'delay_inline_snippets' ), 21 ); |
| 115 | 115 | } |
| 116 | + | |
| 117 | + // Everything above honors data-no-optimize / data-no-minify, but | |
| 118 | + // only sees markers stamped before priority 30. Borlabs Cookie | |
| 119 | + // stamps at 100, so its consent config was minified AND delayed | |
| 120 | + // despite carrying both markers. Snapshot the tag before our | |
| 121 | + // transforms (9) and hand the original back if a marker turns up | |
| 122 | + // after them (1000, past Borlabs' own 100 and 999). Registered | |
| 123 | + // whenever any of the three is on, | |
| 124 | + // since each one is individually enough to damage a marked | |
| 125 | + // script. (#469) | |
| 126 | + if ( ! empty( $opts['minify_js'] ) || ! empty( $opts['defer_js'] ) || ! empty( $opts['delay_js'] ) ) { | |
| 127 | + add_filter( 'script_loader_tag', array( Minify_Filters::class, 'snapshot_tag' ), 9, 3 ); | |
| 128 | + add_filter( | |
| 129 | + 'script_loader_tag', | |
| 130 | + array( Minify_Filters::class, 'revert_late_marked_tag' ), | |
| 131 | + Minify_Filters::late_opt_out_priority(), | |
| 132 | + 3 | |
| 133 | + ); | |
| 134 | + } | |
| 116 | 135 | if ( ! empty( $opts['async_css'] ) ) { |
| 117 | 136 | add_filter( 'style_loader_tag', array( Minify_Filters::class, 'async_style_tag' ), 20, 2 ); |
| 118 | 137 | // style_loader_tag only fires for wp_enqueue_style()'d sheets. |
| 119 | 138 | // Themes print Google/Bunny/Typekit font CSS as literal <link> |