-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Add support for IMG tags with fetchpriority=low or fetchpriority=auto
#11196
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
westonruter
wants to merge
31
commits into
WordPress:trunk
from
westonruter:trac-64823-fetchpriority-loading-optimization-attributes
Closed
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
e35dd28
Ensure IMG with fetchpriority=low does not get lazy-loaded or increas…
westonruter 1477ca6
Improve comment grammar/clarity
westonruter 36ebcb0
Fix typo in comment
westonruter 1fa9a16
Fix grammar typo
westonruter 7f0c9e7
Use single quotes
westonruter 9b1c141
Re-use condition
westonruter 2093108
Add phpdoc params
westonruter f5de5b2
Correct return description for wp_high_priority_element_flag()
westonruter edf76eb
Add missing return type for wp_high_priority_element_flag()
westonruter ec3c508
Update wp_maybe_add_fetchpriority_high_attr() to account for fetchpri…
westonruter 1439f77
Update wp_get_loading_optimization_attributes() to account for fetchp…
westonruter e32f008
Fix fetchpriority attr handling in wp_maybe_add_fetchpriority_high_at…
westonruter 003806e
Backport https://github.com/WordPress/gutenberg/pull/76302
westonruter e489e94
Improve since description
westonruter 6e4e3bc
Fix typo in phpdoc
westonruter e3ec304
Account for IMG as root block element
westonruter 7657a54
Improve test to ensure fetchpriority=auto is added to IMG
westonruter a5a575b
Reuse processor
westonruter 0208a08
Mark WP_HTML_Tag_Processor::next_tag() as impure
westonruter 0b88b8b
Leverage assertEqualHTML in tests and add IMG to more test cases
westonruter e19e290
Apply static analysis fixes to Tests_Block_Supports_Block_Visibility
westonruter d771766
Fix typo in comment
westonruter 11c8683
Correct phpdoc
westonruter fcbcd95
Fix method reference
westonruter dcf1ecb
Refine phpdoc types
westonruter 10c8c91
Fix typo in test_wp_loading_optimization_force_header_contexts_filter
westonruter 0d3b2a0
Use affect instead of effect
westonruter a1bf2a3
Merge branch 'trunk' into trac-64823-fetchpriority-loading-optimizati…
westonruter 86909e1
Avoid treating fetchpriority=auto as maybe_in_viewport and prevent in…
westonruter caaf92b
Fix typo in assertion message
westonruter c8e469d
Replicate assertion in companion test
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -881,6 +881,8 @@ public function change_parsing_namespace( string $new_namespace ): bool { | |
| * @type string|null $tag_closers "visit" or "skip": whether to stop on tag closers, e.g. </div>. | ||
| * } | ||
| * @return bool Whether a tag was matched. | ||
| * | ||
| * @phpstan-impure | ||
|
Member
Author
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. See https://phpstan.org/writing-php-code/phpdocs-basics#impure-functions This is needed so that |
||
| */ | ||
| public function next_tag( $query = null ): bool { | ||
| $this->parse_query( $query ); | ||
|
|
||
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
Oops, something went wrong.
Oops, something went wrong.
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.
This is a backport from WordPress/gutenberg#76302
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.
This function is for “block visibility” support, but it’s now also altering image-loading heuristics globally for any image inside the block. That may be intended, but it’s something that it extend the scope of this function. In future we need to check better place for it. WDYT?
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.
This is the context in which we know that an
IMGwill be conditionally displayed based on the viewport size. There isn't any other code I'm aware of where PHP is aware of such styles being applied. So I don't think there is currently another spot.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.
For visibility: this change was approved in the the corresponding Gutenberg PR by @t-hamano and @ramonjd.