-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Introduce fetchpriority for Scripts and Script Modules
#8815
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
dbcd32c
Output script modules with fetchpriority=low
westonruter 5207c27
Fix duplicate array keys in data_special_chars_script_encoding
westonruter 088366d
Add ability to set fetch priority for script modules
westonruter 9eab85d
Add fetchpriority support for non-module scripts
westonruter d9c4037
Set fetchpriority=low on comment-reply script
westonruter 4f82a4f
Use auto as default fetchpriority for script modules
westonruter f2cd9be
Avoid printing fetchpriority attribute when auto
westonruter ff4fd36
fixup! Use auto as default fetchpriority for script modules
westonruter 9edbe4c
Use HTML Tag Processor to parse import map
westonruter 021fe74
Ensure parity in args between class methods and global function aliases
westonruter 34ef7fa
Use fetch priority low by default for Interactivity API view script m…
westonruter e54274a
Add missing since tag
westonruter cc1d909
Account for full block.json schema when checking for interactivity
westonruter 4197eb2
Merge branch 'trunk' of https://github.com/WordPress/wordpress-develo…
westonruter 74a49e1
Remove PHPStan annotations for commit
westonruter 75fb879
Merge branch 'trunk' of https://github.com/WordPress/wordpress-develo…
westonruter 0e9994a
Merge branch 'trunk' of https://github.com/WordPress/wordpress-develo…
westonruter 06e9cac
Remove TODO comments which have been filed in https://github.com/Word…
westonruter f91c61d
Merge branch 'trunk' of https://github.com/WordPress/wordpress-develo…
westonruter 4596644
Add validation for fetchpriority set on scripts
westonruter 2172e9e
Allow empty string for set_fetchpriority(), return bool, and add tests
westonruter 535669d
Add missing type for args param
westonruter fe366e2
Improve typing for is_delayed_stragegy
westonruter f704f5e
Merge branch 'trunk' of https://github.com/WordPress/wordpress-develo…
westonruter 38150dc
Replace n.e.x.t with 6.9.0
westonruter f05ca72
Ensure reflection property is accessible
westonruter 607ce0c
Use static data provider methods
westonruter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add fetchpriority support for non-module scripts
- Loading branch information
commit 9eab85dc4b0c2d6dbf13356d38bb5f9ea248ad4a
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The fetchpriority is checked against an allowlist for modules. I don't see that for scripts. Did I overlook that or should it be included?
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.
@sirreal In the case of classic scripts, the
fetchpriorityis instead being specified when the scripts are registered. The only script which getslowiscomment-reply:wordpress-develop/src/wp-includes/script-loader.php
Line 1050 in 75fb879
There isn't any allowlist to default to
lowfor non-module scripts since there is no generalizable pattern for being able to opt in like there is for script modules with the Interactivity API.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.
More than default I'm wondering about accepting arbitrary values. It's not likely harmful, but perhaps
_doing_it_wrongcould be shown and the value discarded if an unsupportedfetchpriorityis provided.I understand it's a well defined set of values:
high | low | auto.For example:
produces
which is… silly 🙂
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.
That's a good point. For
async/defer, this is handled in theadd_data()function:wordpress-develop/src/wp-includes/class-wp-scripts.php
Lines 811 to 837 in 75fb879
This would make sense to include there as well for
fetchpriority.