Make WordPress Core

Opened 6 years ago

#45008 new defect (bug)

Inconsistent use of 'script_loader_src' and 'style_loader_src' filters when performing concatenation

Reported by: dimadin's profile dimadin Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 2.8
Component: Script Loader Keywords: has-patch
Focuses: Cc:


When in admin, scripts and styles from default directories (in other words, from /wp-includes and /wp-admin) will by default be concatenated.

But, there is inconsistency in how script_loader_src and style_loader_src filters are used in that case.

style_loader_src is not used when doing concatenation. It receives only full URL of style and is used only in that case.

script_loader_src is used twice. One case is the same as for style_loader_src: only for final, full URL of script. But in second case, it is used when doing concatenation. It is not only inconsistent with its first usage or usage of style_loader_src, it also doesn't really makes sense. It filters path relative to root, not final URL, and result of that filtering is only used when checking if source is in default directories and nowhere else. I don't see what it can really do.

This second case was introduced in [10357] by @azaozz. Before that, filter was used the same way it is used now for the other case. In that same changeset, concatenation was also added for styles, but counterpart filter was not added.

I propose that we remove second case of script_loader_src, used when doing script concatenation.

Attachments (1)

45008.diff (1.7 KB) - added by dimadin 6 years ago.

Download all attachments as: .zip

Change History (1)

6 years ago

Note: See TracTickets for help on using tickets.