@@ -71,6 +71,10 @@ public function test_plwwo_register_default_scripts(): void {
71
71
$ before_data = wp_scripts ()->get_inline_script_data ( 'web-worker-offloading ' , 'before ' );
72
72
$ after_data = wp_scripts ()->get_inline_script_data ( 'web-worker-offloading ' , 'after ' );
73
73
74
+ // See <https://core.trac.wordpress.org/ticket/63887>.
75
+ $ before_data = preg_replace ( ':\n//# sourceURL=.+$: ' , '' , $ before_data );
76
+ $ after_data = preg_replace ( ':\n//# sourceURL=.+$: ' , '' , $ after_data );
77
+
74
78
$ this ->assertTrue ( wp_script_is ( 'web-worker-offloading ' , 'registered ' ) );
75
79
$ this ->assertNotEmpty ( $ before_data );
76
80
$ this ->assertNotEmpty ( $ after_data );
@@ -203,6 +207,15 @@ public function test_update_script_types( Closure $set_up, string $expected ): v
203
207
$ set_up ();
204
208
205
209
$ normalize = static function ( $ html ) {
210
+ // See <https://core.trac.wordpress.org/ticket/63887>.
211
+ $ p = new WP_HTML_Tag_Processor ( $ html );
212
+ while ( $ p ->next_tag ( array ( 'tag_name ' => 'SCRIPT ' ) ) ) {
213
+ $ text = $ p ->get_modifiable_text ();
214
+ $ text = preg_replace ( ':\n//# sourceURL=.+$: ' , '' , $ text );
215
+ $ p ->set_modifiable_text ( $ text );
216
+ }
217
+ $ html = $ p ->get_updated_html ();
218
+
206
219
$ html = preg_replace ( '/\r|\n/ ' , '' , $ html );
207
220
return trim ( preg_replace ( '#(?=<[^/])# ' , "\n" , $ html ) );
208
221
};
0 commit comments