Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRAFT: PR for enhancing WP_Scripts with a loading strategy #54

Closed
Closed
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
307 commits
Select commit Hold shift + click to select a range
5795b4c
restore default values
kt-12 Feb 26, 2023
0ebfaa5
phpcs fixes
kt-12 Feb 26, 2023
f6b0483
Update text
kt-12 Feb 26, 2023
7b36d21
Readability
kt-12 Feb 26, 2023
f71319c
consistent with other docblock descriptions
kt-12 Feb 26, 2023
624e797
casting the result
kt-12 Feb 26, 2023
b7334b7
wordpress coding standards
kt-12 Feb 26, 2023
2cb01be
Merge branch 'enhancement/get_eligible_loading_strategy-ML2-12' of ht…
kt-12 Feb 26, 2023
5305f1c
restore test case
kt-12 Feb 27, 2023
073684a
add temporary ticket id
kt-12 Feb 27, 2023
5e343b8
fix test bug
kt-12 Feb 27, 2023
b56c0e1
restore test case
kt-12 Feb 27, 2023
9caf8bb
Merge branch 'enhancement/get_eligible_loading_strategy-ML2-12' into …
kt-12 Feb 27, 2023
b70ee6c
temporary ticket added for testing
kt-12 Feb 27, 2023
dbf6da9
Merge branch 'enhancement/get_eligible_loading_strategy-ML2-12' into …
kt-12 Feb 27, 2023
2deadcf
remove extra line
kt-12 Feb 27, 2023
fcaa62e
remove after dependency function
kt-12 Feb 27, 2023
150ba8b
Merge branch 'enhancement/get_eligible_loading_strategy-ML2-12' into …
kt-12 Feb 27, 2023
d578e50
fix doc block text
kt-12 Feb 27, 2023
5262bf7
Correct grammar
kt-12 Feb 27, 2023
2970f1a
Fix doc block string.
kt-12 Feb 27, 2023
28af60d
change variable name
kt-12 Feb 27, 2023
f746dfd
doc block changes, better word
kt-12 Feb 27, 2023
00a50d1
Merge branch 'enhancement/get_eligible_loading_strategy-ML2-12' into …
kt-12 Feb 27, 2023
d4bbaff
spacing issue.
kt-12 Feb 27, 2023
01e1d4f
update placeholder with numbered placeholder
kt-12 Feb 28, 2023
a367951
Change ticket id to trac id
kt-12 Feb 28, 2023
51e3e41
Switching from numbered to normal substitution
kt-12 Feb 28, 2023
62cbf60
Breaking test into multiple test functions
kt-12 Feb 28, 2023
0f80794
breaking test to dataprovider
kt-12 Feb 28, 2023
f20cfea
add async and defer check in dependent check
kt-12 Feb 28, 2023
e406a13
Merge branch 'enhancement/get_eligible_loading_strategy-ML2-12' into …
kt-12 Feb 28, 2023
b961108
defer with async dependent
kt-12 Feb 28, 2023
70fb6c6
Add failure messages
kt-12 Feb 28, 2023
2b3d11c
Merge pull request #38 from 10up/enhancement/do_item-ML2-14
kt-12 Feb 28, 2023
16c4634
Merge pull request #35 from 10up/enhancement/get_eligible_loading_str…
kt-12 Mar 1, 2023
a10cb5c
phpcs-fixes
kt-12 Mar 2, 2023
dfbecd8
add parameter
kt-12 Mar 6, 2023
4fa3d7b
butification
kt-12 Mar 6, 2023
043c244
Handling inline before
kt-12 Mar 6, 2023
53a54e6
TODO Note for on Load logic for after
kt-12 Mar 6, 2023
d90ed89
Before Logic.
kt-12 Mar 9, 2023
514876f
test cases
kt-12 Mar 9, 2023
2c31104
bug fix
kt-12 Mar 9, 2023
4e1aaaf
Add non standalone test cases.
kt-12 Mar 9, 2023
df906be
stand alone test case
kt-12 Mar 10, 2023
6be6f16
passing standalone
kt-12 Mar 10, 2023
7564a68
doc block update
kt-12 Mar 10, 2023
484789f
Merge branch 'enhancement/wp-add-inline-script-standalone' into enhan…
kt-12 Mar 10, 2023
3ad953f
keep a track of standalone and non-standalone
kt-12 Mar 10, 2023
dcd2a32
standalone and non-standalone
kt-12 Mar 10, 2023
8d33fac
phpcs fixes
kt-12 Mar 10, 2023
e4b461d
set defaults
kt-12 Mar 10, 2023
8421a1c
update print_inline_script for stand alone
kt-12 Mar 10, 2023
371e42f
fix issue with standalone appending
kt-12 Mar 10, 2023
c517bc1
bug fix incorrect strategy check
kt-12 Mar 10, 2023
04aabf5
numbered attributes
kt-12 Mar 10, 2023
e366d5d
onload script
kt-12 Mar 10, 2023
0fafd88
fix bug
kt-12 Mar 10, 2023
386022e
sprintf issue with \n
kt-12 Mar 11, 2023
fe7acc0
phpcs fixes
kt-12 Mar 11, 2023
394405f
print template loader script
kt-12 Mar 11, 2023
cc5dace
\n to EOL
kt-12 Mar 11, 2023
b558f34
Loading the script before other script
kt-12 Mar 13, 2023
f04a246
temp commit
kt-12 Mar 14, 2023
b5f4df4
check if any delayed inline scripts
kt-12 Mar 15, 2023
2eb8aed
Update src/wp-includes/class-wp-scripts.php
kt-12 Mar 15, 2023
e0e560e
non-stanadalone after script test cases
kt-12 Mar 15, 2023
c856372
test standalone and non-standalone script combined
kt-12 Mar 15, 2023
ff25567
phpcs fix
kt-12 Mar 15, 2023
b2d6ec1
for consistency
kt-12 Mar 15, 2023
d9a0f39
Merge add_text_template to implement_load_handlers
kt-12 Mar 15, 2023
d110556
add new line
kt-12 Mar 16, 2023
b6b7022
backward compatibility
kt-12 Mar 16, 2023
9e8c378
update test utility and scripts.
kt-12 Mar 16, 2023
ffc40c1
php cs fixes
kt-12 Mar 16, 2023
8af918c
fix csfix issue
kt-12 Mar 16, 2023
d952da5
Update test message.
kt-12 Mar 21, 2023
b71b557
Update test comment
kt-12 Mar 21, 2023
479d656
Update test error message
kt-12 Mar 21, 2023
968d5b7
change function names
kt-12 Mar 21, 2023
ad9d9c3
Merge branch 'enhancement/implement_load_handlers' of https://github.…
kt-12 Mar 21, 2023
d522c46
Update doc header.
kt-12 Mar 22, 2023
ce5fc87
Update comment text
kt-12 Mar 22, 2023
0a0b253
comment text grammar.
kt-12 Mar 22, 2023
a24665a
update doc block
kt-12 Mar 22, 2023
f29c144
comment grammar fixes
kt-12 Mar 22, 2023
0988655
comment grammar fixes
kt-12 Mar 22, 2023
d66907e
comment grammar
kt-12 Mar 22, 2023
b7bff57
doc block grammar
kt-12 Mar 22, 2023
013cb1e
comment grammar
kt-12 Mar 22, 2023
db02925
update doc block for grammar
kt-12 Mar 22, 2023
42bc576
updated grammar
kt-12 Mar 22, 2023
07179c8
update comment text
kt-12 Mar 22, 2023
169fc28
Update comment
kt-12 Mar 22, 2023
ad9cafb
Update comment
kt-12 Mar 22, 2023
5cda63d
Update comment
kt-12 Mar 22, 2023
a587e5e
Update doc block.
kt-12 Mar 22, 2023
b861844
Update doc block
kt-12 Mar 22, 2023
70122ff
Update comment
kt-12 Mar 22, 2023
c81fdf2
Update comment
kt-12 Mar 22, 2023
2dce5f4
Update comment
kt-12 Mar 22, 2023
2571691
Update comment
kt-12 Mar 22, 2023
b7ac63f
grammar fix
kt-12 Mar 22, 2023
326555d
use unregister column
kt-12 Mar 22, 2023
8d5729c
Merge branch 'enhancement/update-wp-add-inline-script-standalone' int…
kt-12 Mar 22, 2023
6187dd1
Merge branch 'enhancement/add_text_template' into enhancement/impleme…
kt-12 Mar 22, 2023
1321d6f
avoid removal of jquery libraries
kt-12 Mar 23, 2023
66ab60c
Dataprovider doc block.
kt-12 Mar 23, 2023
bbdad37
doc block change
kt-12 Mar 23, 2023
24452a6
Abort/reset script concatenation if the handle in question is of a de…
10upsimon Mar 27, 2023
08f200f
Fixed comment typo
10upsimon Mar 27, 2023
966be0c
Update src/wp-includes/class-wp-scripts.php
kt-12 Mar 28, 2023
f9355cd
Merge branch 'enhancement/implement_load_handlers' into add/issue-48-…
kt-12 Mar 28, 2023
ae38432
strategy already available
kt-12 Mar 28, 2023
54c74be
Add more specific defer and async strategy checks for concatenation e…
10upsimon Mar 28, 2023
31e4507
test defer script with concat
kt-12 Mar 29, 2023
2031aff
concat with async
kt-12 Mar 29, 2023
6beabce
blocking before and after defer
kt-12 Mar 29, 2023
a8dba9f
Merge origin into local
10upsimon Mar 29, 2023
6d75add
Merge branch 'add/issue-48-abort-script-strategy-logic-when-concat-sc…
10upsimon Mar 29, 2023
ffe725c
Remove two trailing spaces in printed output that were failing test i…
10upsimon Mar 30, 2023
c656495
Replaced hard coded references to default script directory string to …
10upsimon Mar 30, 2023
23630b9
Fix spacing for PHPCS
joemcgill Mar 30, 2023
2087305
Update script handle name to match async strategy in tests
joemcgill Mar 30, 2023
dcbf0af
Update doc text
kt-12 Mar 31, 2023
01c890e
bug: multiple type in a single script.
kt-12 Mar 31, 2023
9aaca52
print_display
kt-12 Mar 31, 2023
8e08454
Merge branch 'enhancement/add_text_template' into enhancement/impleme…
kt-12 Mar 31, 2023
b3f7225
fix type_attr no there issue
kt-12 Mar 31, 2023
4df5288
adding description
kt-12 Mar 31, 2023
264853c
broke standalone script test to multiple function
kt-12 Mar 31, 2023
556ae91
non-standalone after script test broken
kt-12 Mar 31, 2023
d4be88d
before standalone test broken
kt-12 Mar 31, 2023
180a6ae
non standalone with before and defer
kt-12 Mar 31, 2023
fdf0bd3
Merge branch 'enhancement/implement_load_handlers' into add/issue-48-…
kt-12 Mar 31, 2023
4b16162
remove extra variable
kt-12 Mar 31, 2023
0c7d18e
remove hardcoded type
kt-12 Mar 31, 2023
4d0140d
used function instead of arrow function.
kt-12 Mar 31, 2023
a5b83a4
single condition
kt-12 Mar 31, 2023
0269128
put back handle
kt-12 Mar 31, 2023
db29ae2
Merge pull request #47 from 10up/enhancement/update-wp-add-inline-scr…
kt-12 Apr 1, 2023
28ba27c
Merge pull request #46 from 10up/enhancement/wp-add-inline-script-sta…
10upsimon Apr 3, 2023
4cc2502
Merge pull request #50 from 10up/enhancement/implement_load_handlers
10upsimon Apr 3, 2023
0007785
Merge pull request #49 from 10up/enhancement/add_text_template
10upsimon Apr 3, 2023
59ee419
Merge branch 'enhancement/wp-script-api-strategy-base' of github.com:…
10upsimon Apr 3, 2023
6125283
Merge branch 'trunk' of github.com:10up/wordpress-develop into trunk
10upsimon Apr 3, 2023
71811ab
Merge branch 'trunk' into enhancement/wp-script-api-strategy-base
10upsimon Apr 3, 2023
f61d867
Merge branch 'enhancement/implement_load_handlers' into add/issue-48-…
kt-12 Apr 3, 2023
90e6105
Merge pull request #51 from 10up/add/issue-48-abort-script-strategy-l…
kt-12 Apr 3, 2023
88fe91d
Merge branch 'enhancement/wp-script-api-strategy-base' of github.com:…
10upsimon Apr 3, 2023
82d5ea8
Merge pull request #53 from 10up/trunk
10upsimon Apr 3, 2023
569fd3e
Merge branch 'trunk' of github.com:10up/wordpress-develop into trunk
10upsimon Apr 3, 2023
9eb6336
Merge branch 'trunk' into enhancement/wp-script-api-strategy-base
10upsimon Apr 3, 2023
76b3705
Merge branch 'feature/enhance-wp-scripts-api-with-a-loading-strategy'…
joemcgill Apr 3, 2023
1b7ac23
Merge branch 'trunk' into feature/enhance-wp-scripts-api-with-a-loadi…
joemcgill Apr 3, 2023
5114138
Merge branch 'feature/enhance-wp-scripts-api-with-a-loading-strategy'…
joemcgill Apr 3, 2023
204ff24
Merge pull request #52 from 10up/enhancement/wp-script-api-strategy-base
10upsimon Apr 3, 2023
2e8cbfa
moving down the code by few lines
kt-12 Apr 12, 2023
70aed2d
adding a new line - clean code
kt-12 Apr 12, 2023
146499d
add some useful information in comment
kt-12 Apr 12, 2023
0be95f2
code readability
kt-12 Apr 12, 2023
24003f0
optional in doc type
kt-12 Apr 12, 2023
a3baa8d
Update comment text.
kt-12 Apr 12, 2023
4945a14
default true
kt-12 Apr 12, 2023
f062f0b
standalone optional
kt-12 Apr 12, 2023
239ee0b
Merge branch 'feature/enhance-wp-scripts-api-with-a-loading-strategy'…
kt-12 Apr 12, 2023
626e2bf
default false
kt-12 Apr 12, 2023
c3f5898
typo
kt-12 Apr 12, 2023
fefe6ee
add line
kt-12 Apr 12, 2023
1052b59
add a line for clean code
kt-12 Apr 12, 2023
1d7b9bd
add a line
kt-12 Apr 12, 2023
b10982d
fixing comment
kt-12 Apr 12, 2023
30747d1
add a line for clean code
kt-12 Apr 12, 2023
0b393b7
comment language fix.
kt-12 Apr 12, 2023
4df050c
$handle is not optional
kt-12 Apr 12, 2023
e4c5128
update comment.
kt-12 Apr 12, 2023
ae5797b
improve doc block comment
kt-12 Apr 12, 2023
90764c8
clean code add a line
kt-12 Apr 12, 2023
08ed2d3
add a line
kt-12 Apr 12, 2023
97846ba
doc type text update.
kt-12 Apr 12, 2023
03cb904
add a line for clean code.
kt-12 Apr 12, 2023
a569440
update doc block.
kt-12 Apr 12, 2023
5be4ecf
add a line for clean code.
kt-12 Apr 12, 2023
5bc5864
add a new line.
kt-12 Apr 12, 2023
37eeff9
Update doc block comments
kt-12 Apr 12, 2023
9f91ccb
change function name
kt-12 Apr 12, 2023
09c4abb
Merge branch 'feature/enhance-wp-scripts-api-with-a-loading-strategy'…
kt-12 Apr 12, 2023
4e59471
is_valid_script
kt-12 Apr 13, 2023
a75c67d
fix grammar
kt-12 Apr 13, 2023
bfc27f9
bug fix get_intended_strategy
kt-12 Apr 14, 2023
06514c4
return false if invalid strategy used.
kt-12 Apr 14, 2023
59d2503
invalid script strategy test
kt-12 Apr 14, 2023
fb93f94
script strategy doing it wrong.
kt-12 Apr 14, 2023
9804459
in_array with helper function
kt-12 Apr 14, 2023
83b2b27
Merge branch 'feature/enhance-wp-scripts-api-with-a-loading-strategy'…
10upsimon Apr 14, 2023
286d589
update doc block
kt-12 Apr 14, 2023
15dfe0f
typo fix
kt-12 Apr 14, 2023
909714e
code cleanup
kt-12 Apr 14, 2023
4534440
fix grammar.
kt-12 Apr 14, 2023
f5d4b55
fix grammar
kt-12 Apr 14, 2023
4be6d42
update comment
kt-12 Apr 14, 2023
3385b26
inline type template
kt-12 Apr 20, 2023
3b46fe9
hardcode type
kt-12 Apr 20, 2023
b1d57ea
function name change
kt-12 Apr 20, 2023
5508cf0
placeholder
kt-12 Apr 20, 2023
996e018
fix issue
kt-12 Apr 20, 2023
654d1e7
Merge branch 'feature/enhance-wp-scripts-api-with-a-loading-strategy'…
kt-12 Apr 20, 2023
a80156f
Change docblock description for is_non_blocking_strategy method
10upsimon Apr 21, 2023
b92f5be
Merge pull request #57 from 10up/enhancement/create-helper-for-delaye…
10upsimon Apr 21, 2023
8549c52
Updated description and param decription within docblock of is_valid_…
10upsimon Apr 21, 2023
281aadc
Merge pull request #56 from 10up/enhancement/add_valid_strategy_function
10upsimon Apr 21, 2023
69f20dd
Merge branch 'feature/enhance-wp-scripts-api-with-a-loading-strategy'…
10upsimon Apr 24, 2023
bd4c18c
Handle malicious attempts more robustly
10upsimon Apr 25, 2023
156555d
Return empty string if no strategy set as part of get_intended_strate…
10upsimon Apr 25, 2023
e0c60d4
Renamed wp_print_template_loader_script function to wp_print_delayed_…
10upsimon Apr 25, 2023
07ae509
Change let to const within wpLoadAfterScripts as scripts assignment i…
10upsimon Apr 25, 2023
35bc9c7
Replace usage of innerHTML with textContent within wp_print_delayed_i…
10upsimon Apr 25, 2023
2b6155a
Replaced usage of printf with wp_print_inline_script_tag within wp_pr…
10upsimon Apr 25, 2023
3ad9b74
Updated docblock for wp_register_script to indicate change from to
10upsimon Apr 25, 2023
8116c22
Updated docblock for wp_enqueue_script to indicate change from to
10upsimon Apr 25, 2023
6bccf2e
Additon of @since 6.3.0 to docblock for changes to add_inline_script …
10upsimon Apr 25, 2023
213d83d
Added @since 6.3.0 for newly added has_delayed_inline_script function
10upsimon Apr 25, 2023
dc9f902
Added @since 6.3.0 for newly added add_data function
10upsimon Apr 25, 2023
fd16848
Added @since 6.3.0 for newly added get_normalized_script_args function
10upsimon Apr 25, 2023
1a77dd4
Added @since 6.3.0 for newly added get_dependents function
10upsimon Apr 25, 2023
d0e740e
Added @since 6.3.0 for newly added is_valid_strategy function
10upsimon Apr 25, 2023
6801291
Added @since 6.3.0 for newly added get_intended_strategy function
10upsimon Apr 25, 2023
dbca402
Added @since 6.3.0 for newly added is_non_blocking_strategy function
10upsimon Apr 25, 2023
17516c7
Added @since 6.3.0 for newly added has_non_standalone_inline_script f…
10upsimon Apr 25, 2023
9813ba8
Added @since 6.3.0 for newly added has_only_deferrable_dependents fun…
10upsimon Apr 25, 2023
0c90511
Added @since 6.3.0 for newly added get_eligible_loading_strategy func…
10upsimon Apr 25, 2023
25db6e8
Added @since 6.3.0 for newly added wp_print_delayed_inline_script_loa…
10upsimon Apr 25, 2023
b61fe3d
Remove space prior to command in argument list, causing linting error
10upsimon Apr 25, 2023
343e5ed
Update unit test logic for test_non_standalone_and_standalone_after_s…
10upsimon Apr 25, 2023
79ef56d
Update unit test logic for test_non_standalone_and_standalone_after_s…
10upsimon Apr 25, 2023
f75a8d2
Replace double quotes with '"' for certain inline script conditi…
10upsimon Apr 25, 2023
2770ba9
Updates to test suite logic to account for new double quotes and esca…
10upsimon Apr 25, 2023
9d0e68c
Updates to test_non_standalone_after_inline_script_with_defer_main_sc…
10upsimon Apr 26, 2023
3044aa3
Added private var to store a handles dependents against, in order to…
10upsimon Apr 26, 2023
3ca847e
Cleaner output handling within print_inline_script when display condi…
10upsimon Apr 26, 2023
edd3d52
Cleanup/optimzation of code within do_item function for inline script…
10upsimon Apr 26, 2023
59324a8
Docblock wording change
10upsimon Apr 26, 2023
6ab9511
Update applicable core calls to wp_register_script() to reflect new f…
10upsimon Apr 26, 2023
5a94bfa
Fix formatting issue causing PHPCS failure
10upsimon Apr 26, 2023
0e120b7
Rewrite function body for wpLoadAfterScripts to be ES5 and not requir…
10upsimon Apr 27, 2023
da5668f
Updated function body for wpLoadAfterScripts to reflect updated funct…
10upsimon Apr 27, 2023
9c3ded2
Update js formatting within wpLoadAfterScripts function
10upsimon Apr 27, 2023
3d9d0d8
Update js formatting within wpLoadAfterScripts function used in test …
10upsimon Apr 27, 2023
430e5b2
Updated formatting of wpLoadAfterScripts js function to satisfy WP co…
10upsimon Apr 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/wp-content/themes/twentytwentyone/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ function twenty_twenty_one_scripts() {
get_template_directory_uri() . '/assets/js/polyfills.js',
array(),
wp_get_theme()->get( 'Version' ),
true
array( 'in_footer' => true )
10upsimon marked this conversation as resolved.
Show resolved Hide resolved
);

// Register the IE11 polyfill loader.
Expand All @@ -434,7 +434,7 @@ function twenty_twenty_one_scripts() {
null,
array(),
wp_get_theme()->get( 'Version' ),
true
array( 'in_footer' => true )
10upsimon marked this conversation as resolved.
Show resolved Hide resolved
);
wp_add_inline_script(
'twenty-twenty-one-ie11-polyfills',
Expand Down
3 changes: 2 additions & 1 deletion src/wp-includes/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ function register_block_script_handle( $metadata, $field_name, $index = 0 ) {
$script_handle,
$script_uri,
$script_dependencies,
isset( $script_asset['version'] ) ? $script_asset['version'] : false
isset( $script_asset['version'] ) ? $script_asset['version'] : false,
array( 'in_footer' => false )
10upsimon marked this conversation as resolved.
Show resolved Hide resolved
);
if ( ! $result ) {
return false;
Expand Down
Loading