Skip to content

Fix source-less JS handle ordering#90

Merged
luismulinari merged 2 commits into
masterfrom
fix-source-less-js-handle-order
May 12, 2026
Merged

Fix source-less JS handle ordering#90
luismulinari merged 2 commits into
masterfrom
fix-source-less-js-handle-order

Conversation

@luismulinari
Copy link
Copy Markdown
Contributor

@luismulinari luismulinari commented May 12, 2026

Description

  • Defers source-less JS handles through the same ordered output queue used for non-concatenated scripts.
  • Keeps pending concat chunks before alias/group inline output, matching WordPress' WP_Scripts::do_item() ordering behavior.
  • Adds a regression test covering js_do_concat disabled with a source-less handle that has script dependencies and inline output.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts WPcom_JS_Concat::do_items() so that source-less (alias/group) script handles are deferred into the same ordered output queue as non-concatenated scripts, ensuring concatenated chunks are emitted before any inline output attached to those source-less handles (aligning more closely with WordPress core ordering).

Changes:

  • Defer source-less script handles by queueing them as do_item entries instead of printing immediately.
  • Add a regression test to validate ordering when js_do_concat is disabled and a source-less handle has dependencies plus inline output.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
jsconcat.php Defers source-less handles into the ordered $javascripts queue so pending concat chunks print before alias/group inline output.
tests/test-jsconcat-order.php Adds a regression test that asserts output ordering for a source-less handle when concat is disabled.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/test-jsconcat-order.php Outdated
@luismulinari luismulinari force-pushed the fix-source-less-js-handle-order branch 3 times, most recently from 828799e to ff54b55 Compare May 12, 2026 18:11
@luismulinari luismulinari force-pushed the fix-source-less-js-handle-order branch from ff54b55 to 5ef3ac9 Compare May 12, 2026 18:12
@luismulinari luismulinari merged commit 483223b into master May 12, 2026
7 checks passed
@sjinks sjinks deleted the fix-source-less-js-handle-order branch May 13, 2026 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants