File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -350,7 +350,16 @@ public function do_item( $handle, $group = false ) {
350350
351351 $ translations = $ this ->print_translations ( $ handle , false );
352352 if ( $ translations ) {
353- $ translations = wp_get_inline_script_tag ( $ translations , array ( 'id ' => "{$ handle }-js-translations " ) );
353+ /**
354+ * The soucreURL comment is not included by @see WP_Scripts::print_translations()
355+ * when `$display == false` to prevent issues where the script tag contents are used
356+ * by extenders for other purposes, for example concatenated with other script content.
357+ *
358+ * Include the sourceURL comment here as it would be when printed directly.
359+ */
360+ $ source_url = rawurlencode ( "{$ handle }-js-translations " );
361+ $ translations .= "\n//# sourceURL= {$ source_url }" ;
362+ $ translations = wp_get_inline_script_tag ( $ translations , array ( 'id ' => "{$ handle }-js-translations " ) );
354363 }
355364
356365 if ( $ this ->do_concat ) {
You can’t perform that action at this time.
0 commit comments