-
Notifications
You must be signed in to change notification settings - Fork 0
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
Implement load handlers #50
Changes from 1 commit
04aabf5
e366d5d
0fafd88
386022e
fe7acc0
394405f
cc5dace
b558f34
f04a246
b5f4df4
d9a0f39
d110556
b6b7022
9e8c378
ffc40c1
8af918c
d952da5
b71b557
479d656
968d5b7
ad9d9c3
326555d
6187dd1
1321d6f
66ab60c
bbdad37
966be0c
dcbf0af
8e08454
b3f7225
4df5288
264853c
556ae91
d4be88d
180a6ae
4d0140d
a5b83a4
0269128
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -1846,15 +1846,15 @@ function wp_just_in_time_script_localization() { | |||
|
||||
/** | ||||
* Prints a loader script if there is text/template registered script. | ||||
* | ||||
* When injected in DOM, this script converts any text/template script | ||||
* | ||||
* When injected in DOM, this script converts any text/template script | ||||
* associated with a handle to type/javascript and execute them. | ||||
*/ | ||||
function wp_print_template_loader_script() { | ||||
$wp_scripts = wp_scripts(); | ||||
if ( $wp_scripts->has_delayed_inline_script() ) { | ||||
$output = <<<JS | ||||
let wpLoadAfterScripts = ( handle ) => { | ||||
function wpLoadAfterScripts() { | ||||
let scripts = document.querySelectorAll(`[type="text/template"][data-wp-executes-after="\${handle}"]`); | ||||
scripts.forEach( (script) => { | ||||
script.setAttribute("type","text/javascript"); | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
WP use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mukeshpanchal27 this is the JS code for modifying type after a script is loaded on the DOM. So we can't use |
||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You still need to accept a
handle
param, right?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.