Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for script strategy (#34072)
* Add support for script strategy * Script strategy was introduced in 6.3 * Update projects/packages/assets/src/class-assets.php Co-authored-by: Brad Jorsch <[email protected]> * Update projects/packages/assets/src/class-assets.php Co-authored-by: Brad Jorsch <[email protected]> * Switch version check to use `$wp_versoin` global * Add strategy option * Enable async support for strategy option * Update projects/packages/assets/src/class-assets.php Co-authored-by: Brad Jorsch <[email protected]> * Simplify logic as per PR suggestion * Support deprecated `async` attribute using new strategy=‘defer’ * Deprecate add_async_script * Adjust use of add_async_script in class-tracking-pixel.php * Deprecate script_add_async * Hook `script_add_async` conditionally * Deprecate `enqueue_async_script` (and restore pre-PR code) * Update uses of enqueue_async_script to use register_script instead * Deprecate the async option, improve doc block * restore `enqueue_async_script` * Try: add tests for strategy * Remove pre-6.3 code from Stats This gives us the opportunity to remove the need for the Assets package entirely. * Update tests following feedback See https://github.com/Automattic/jetpack/pull/34072/files#r1396404112 Co-authored-by: Brad Jorsch <[email protected]> * Remove pre-6.3 code Jetpack now requires WordPress 6.3 * Address feedback from code review See: - https://github.com/Automattic/jetpack/pull/34072/files#r1396389177 - https://github.com/Automattic/jetpack/pull/34072/files#r1396389463 - https://github.com/Automattic/jetpack/pull/34072/files#r1396359251 - https://github.com/Automattic/jetpack/pull/34072/files#r1396389743 - https://github.com/Automattic/jetpack/pull/34072/files#r1396362871 - https://github.com/Automattic/jetpack/pull/34072/files#r1396363681 - https://github.com/Automattic/jetpack/pull/34072/files#r1396393051 - https://github.com/Automattic/jetpack/pull/34072/files#r1396373098 * Bump versions * Avoid PHP notice See https://github.com/Automattic/jetpack/pull/34072/files#r1396372023 * Update doc See #34072 (comment) Co-authored-by: Brad Jorsch <[email protected]> * Move changelog entry to the right package. * Remove tests for deprecated method * Fix tests * Version bumps * Have to use Mockery::type there rather than PHPUnit's Assert::isType * Bump version * Update enqueuing method for Forms script * Update enqueuing method, set defer directly when enqueuing See #34072 (comment) * bump version --------- Co-authored-by: Brad Jorsch <[email protected]> Co-authored-by: Jeremy Herve <[email protected]> Co-authored-by: Brad Jorsch <[email protected]>
- Loading branch information