WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/22/2018 06:12:55 AM (19 months ago)
Author:
pento
Message:

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

See [36550] for WP_Styles.

Merges [43565] to the 5.0 branch.

Props bpayton.
Fixes #44551.

Location:
branches/5.0
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.0

  • branches/5.0/src/wp-includes/class.wp-scripts.php

    r41686 r43788  
    265265        if ( $after_handle ) {
    266266            $after_handle = sprintf( "<script type='text/javascript'>\n%s\n</script>\n", $after_handle );
     267        }
     268
     269        if ( $before_handle || $after_handle ) {
     270            $inline_script_tag = "{$cond_before}{$before_handle}{$after_handle}{$cond_after}";
     271        } else {
     272            $inline_script_tag = '';
    267273        }
    268274
     
    308314
    309315        // A single item may alias a set of items, by having dependencies, but no source.
    310         if ( ! $obj->src ) {
     316        if ( ! $src ) {
     317            if ( $inline_script_tag ) {
     318                if ( $this->do_concat ) {
     319                    $this->print_html .= $inline_script_tag;
     320                } else {
     321                    echo $inline_script_tag;
     322                }
     323            }
     324
    311325            return true;
    312326        }
Note: See TracChangeset for help on using the changeset viewer.