Make WordPress Core

Opened 3 months ago

Last modified 3 months ago

#49470 new defect (bug)

Script loader: simplify maintenance

Reported by: azaozz Owned by:
Milestone: 5.5 Priority: normal
Severity: normal Version: 5.0
Component: Script Loader Keywords: needs-patch
Focuses: Cc:


The main functionality of script-loader is to provide a list of all WordPress scripts and stylesheets together with their dependencies, translation objects and extra/inline code.

During the WP 5.0 development a few (shorthand) functions were introduced that output hard-coded data used to "construct" that list by running several loops instead of the simpler, one-line definitions like in the pre-existing list. This makes it harder to "see" and maintain the entries in the list, and doesn't bring any benefits (all data is still hard-coded, but is now in separate places). It also makes it harder to "dynamically" extract and construct the scripts list like in #48154.

For best results and easier maintenance the "helper functions" introduced in WP 5.0 should be removed and the list of scripts in wp_default_scripts () should include all entries.

Change History (1)

#1 @azaozz
3 months ago

  • Keywords needs-patch added

Looks like an exception would be wp_tinymce_inline_scripts() as it duplicates some of the functionality from class-wp-editor.php, but worth another look at how to do that better.

Another case to try to improve is outputting the polyfills (get rid of document.write, etc.).

Note: See TracTickets for help on using tickets.