Make WordPress Core

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


Ignore:
Timestamp:
06/20/2023 10:16:32 AM (12 months ago)
Author:
azaozz
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #12009, comment 134

    initial v1  
    55> Such an after inline script would break if it were automatically wrapped in an event handler callback.
    66
    7 @westonruter And how hard would it be to fix/improve that script when transition it to use `async` or `defer`? :)
    8 Also, ideally the developers will wrap their inline code in an event callback or lambda function or something similar, not just "dump it" in global scope. So the transition to using `async` or `defer` could actually be used to improve their JS too.
     7@westonruter And how hard would it be to fix/improve that script when transition it to use `async` or `defer`? :)
     8
     9Also, once this event handler is added, the inline script won't need to be outputted "after" the main script. Can be outputted at any time making it a lot more flexible, less dependent on PHP, and generally of a bit better quality.
     10
     11Ideally the developers will wrap their inline code in an event callback or lambda function or something similar, not just "dump it" in global scope. So the transition to using `async` or `defer` could actually be used to improve their JS too.
    912
    1013> in many cases it is correctly used by developer to pass data from PHP to javascript