[wp-trac] [WordPress Trac] #44484: Mediaelement scripts forced loaded in header

WordPress Trac noreply at wordpress.org
Sat Jun 30 12:31:31 UTC 2018


#44484: Mediaelement scripts forced loaded in header
--------------------------+-----------------------------
 Reporter:  Themezly      |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  4.9.6
 Severity:  major         |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Before this https://make.wordpress.org/core/2017/10/30/mediaelement-
 upgrades-in-wordpress-4-9/

 media element scripts were loading where called

 example:



 {{{
 wp_enqueue_script( 'wp-mediaelement' ); // loads above site-scripts in
 footer with dependencies

 /*
 mediaelement-and-player.min.js
 wp-mediaelement.min.js
 */

 wp_enqueue_script( 'site-scripts'); // loads in footer as needed
 }}}

 now

 mediaelement.min.js
 mediaelement-core.min.js

 load in head and wp-mediaelement.min.js loads in footer

 If I call them one by one without calling wp-mediaelement the order is
 kept


 {{{
 wp_enqueue_script( 'mediaelement-migrate' );// loads in footer
 wp_enqueue_script( 'mediaelement-core' );// loads in footer
 wp_enqueue_script( 'site-scripts'); // loads in footer
 }}}


 if you look here it is intended for all of them to be in footer

 https://github.com/WordPress/WordPress/blob/6a9a5e123c49862babf664367c26c89499fed4e0
 /wp-includes/script-loader.php#L377-L378

 https://github.com/WordPress/WordPress/blob/6a9a5e123c49862babf664367c26c89499fed4e0
 /wp-includes/script-loader.php#L474

 but wp_enqueue_script( 'wp-mediaelement' );

 depends on  wp_enqueue_script( 'mediaelement' );
 http://prntscr.com/k15288

 https://github.com/WordPress/WordPress/blob/6a9a5e123c49862babf664367c26c89499fed4e0
 /wp-includes/script-loader.php#L376

 which loads in header only


 so we can never move the scripts to footer where they should be

 If I set the mediaelement to load in footer everything works as intended.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/44484>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list