Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #12009, comment 97


Ignore:
Timestamp:
05/09/2023 10:41:41 PM (17 months ago)
Author:
azaozz
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #12009, comment 97

    initial v1  
    77I still don't see why (and how) async scripts can be handled through script-loader. As I said earlier, they cannot be used as a dependency and cannot be dependent on other scripts because of the unknown execution order.
    88
    9 It would be much cleaner and easier if themes and plugins output these scripts themselves at the appropriate `wp_print_scripts` action. There they can also handle any before/after scripts, etc.
     9It would be much cleaner and easier if themes and plugins output these scripts themselves at the appropriate `*print_scripts*` action. There they can also handle any before/after scripts, etc.
    1010
    1111> In order to maintain execution order for inline scripts attached to `defer` and `async` scripts, we've attempted to control the loading order of those inline scripts by printing them with the type `text/template` so they're not initially executed, and then executing them after the script they're attached to has loaded. @westonruter added [https://github.com/WordPress/wordpress-develop/pull/4391#issuecomment-1536869109 a great explanation] about how this can lead to subtle CSP issues that we need to address.