Opened 19 months ago
Last modified 19 months ago
#63179 new defect (bug)
Dependencies should load in the footer if the script is loaded in the footer
| Reported by: | kkmuffme | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Script Loader | Version: | |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
Description
Followup to https://core.trac.wordpress.org/ticket/35956
<?php wp_register_script('parent','parent.js', array('child'), '1', array( 'in_footer' => true ) ); wp_register_script('child', 'child.js', array(), '1' ); wp_enqueue_script('parent');
This will print "child" in head, but parent in the footer.
But child should print in the footer too I guess, since it's just loaded as dependency?
I assume this is bc of https://github.com/WordPress/wordpress-develop/blob/trunk/src/wp-includes/class-wp-scripts.php#L314C6-L314C22 with docs:
- The intended strategy is delayed.
Why does the intended strategy matter here for the dependency?
Removing that condition should fix it (not tested, just assuming it from what I see in the code)
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)