WordPress.org

Make WordPress Core


Ignore:
Timestamp:
08/11/2018 05:41:29 PM (19 months ago)
Author:
SergeyBiryukov
Message:

Script/Style Dependencies: Make sure that inline scripts for handles without a source are printed.

See [36550] for WP_Styles.

Props bpayton.
Fixes #44551.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class.wp-scripts.php

    r43563 r43565  
    270270        if ( $after_handle ) {
    271271            $after_handle = sprintf( "<script type='text/javascript'>\n%s\n</script>\n", $after_handle );
     272        }
     273
     274        if ( $before_handle || $after_handle ) {
     275            $inline_script_tag = "{$cond_before}{$before_handle}{$after_handle}{$cond_after}";
     276        } else {
     277            $inline_script_tag = '';
    272278        }
    273279
     
    313319
    314320        // A single item may alias a set of items, by having dependencies, but no source.
    315         if ( ! $obj->src ) {
     321        if ( ! $src ) {
     322            if ( $inline_script_tag ) {
     323                if ( $this->do_concat ) {
     324                    $this->print_html .= $inline_script_tag;
     325                } else {
     326                    echo $inline_script_tag;
     327                }
     328            }
     329
    316330            return true;
    317331        }
Note: See TracChangeset for help on using the changeset viewer.