WordPress.org

Make WordPress Core

Opened 6 months ago

Last modified 2 weeks ago

#49470 new defect (bug)

Script loader: simplify maintenance

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

Description

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 (5)

#1 @azaozz
6 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.).

This ticket was mentioned in Slack in #core by david.baumwald. View the logs.


7 weeks ago

#3 @davidbaumwald
3 weeks ago

@azaozz Is this still doable for 5.5?

#4 @azaozz
3 weeks ago

  • Milestone changed from 5.5 to Future Release

This is still mostly TBD. Lets move it to future release.

This ticket was mentioned in Slack in #core by david.baumwald. View the logs.


2 weeks ago

Note: See TracTickets for help on using tickets.