Add `fetchPriority` to `<img>` and `<link>` (#25927)

<!--
  Thanks for submitting a pull request!
We appreciate you spending the time to work on these changes. Please
provide enough information so that others can review your pull request.
The three fields below are mandatory.

Before submitting a pull request, please make sure the following is
done:

1. Fork [the repository](https://github.com/facebook/react) and create
your branch from `main`.
  2. Run `yarn` in the repository root.
3. If you've fixed a bug or added code that should be tested, add tests!
4. Ensure the test suite passes (`yarn test`). Tip: `yarn test --watch
TestName` is helpful in development.
5. Run `yarn test --prod` to test in the production environment. It
supports the same options as `yarn test`.
6. If you need a debugger, run `yarn debug-test --watch TestName`, open
`chrome://inspect`, and press "Inspect".
7. Format your code with
[prettier](https://github.com/prettier/prettier) (`yarn prettier`).
8. Make sure your code lints (`yarn lint`). Tip: `yarn linc` to only
check changed files.
  9. Run the [Flow](https://flowtype.org/) type checks (`yarn flow`).
  10. If you haven't already, complete the CLA.

Learn more about contributing:
https://reactjs.org/docs/how-to-contribute.html
-->

## Summary

- Fixes https://github.com/facebook/react/issues/25682

## How did you test this change?

I tried this but it didn't work
```
yarn build --type=UMD_DEV react/index,react-dom && cd fixtures/attribute-behavior && yarn install && yarn start
```

Co-authored-by: eps1lon <silbermann.sebastian@gmail.com>
This commit is contained in:
Steven 2022-12-23 14:31:27 -05:00 committed by GitHub
parent 81d4ee9ca5
commit de7d1c9071
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 94 additions and 0 deletions

View File

@ -3348,6 +3348,81 @@
| `externalResourcesRequired=(null)`| (initial)| `<null>` |
| `externalResourcesRequired=(undefined)`| (initial)| `<null>` |
## `fetchPriority` (on `<img>` inside `<div>`)
| Test Case | Flags | Result |
| --- | --- | --- |
| `fetchPriority=(string)`| (changed)| `"high"` |
| `fetchPriority=(empty string)`| (initial)| `"auto"` |
| `fetchPriority=(array with string)`| (changed)| `"high"` |
| `fetchPriority=(empty array)`| (initial)| `"auto"` |
| `fetchPriority=(object)`| (initial)| `"auto"` |
| `fetchPriority=(numeric string)`| (initial)| `"auto"` |
| `fetchPriority=(-1)`| (initial)| `"auto"` |
| `fetchPriority=(0)`| (initial)| `"auto"` |
| `fetchPriority=(integer)`| (initial)| `"auto"` |
| `fetchPriority=(NaN)`| (initial, warning)| `"auto"` |
| `fetchPriority=(float)`| (initial)| `"auto"` |
| `fetchPriority=(true)`| (initial, warning)| `"auto"` |
| `fetchPriority=(false)`| (initial, warning)| `"auto"` |
| `fetchPriority=(string 'true')`| (initial)| `"auto"` |
| `fetchPriority=(string 'false')`| (initial)| `"auto"` |
| `fetchPriority=(string 'on')`| (initial)| `"auto"` |
| `fetchPriority=(string 'off')`| (initial)| `"auto"` |
| `fetchPriority=(symbol)`| (initial, warning)| `"auto"` |
| `fetchPriority=(function)`| (initial, warning)| `"auto"` |
| `fetchPriority=(null)`| (initial)| `"auto"` |
| `fetchPriority=(undefined)`| (initial)| `"auto"` |
## `fetchpriority` (on `<img>` inside `<div>`)
| Test Case | Flags | Result |
| --- | --- | --- |
| `fetchpriority=(string)`| (changed, warning)| `"high"` |
| `fetchpriority=(empty string)`| (initial, warning)| `"auto"` |
| `fetchpriority=(array with string)`| (changed, warning)| `"high"` |
| `fetchpriority=(empty array)`| (initial, warning)| `"auto"` |
| `fetchpriority=(object)`| (initial, warning)| `"auto"` |
| `fetchpriority=(numeric string)`| (initial, warning)| `"auto"` |
| `fetchpriority=(-1)`| (initial, warning)| `"auto"` |
| `fetchpriority=(0)`| (initial, warning)| `"auto"` |
| `fetchpriority=(integer)`| (initial, warning)| `"auto"` |
| `fetchpriority=(NaN)`| (initial, warning)| `"auto"` |
| `fetchpriority=(float)`| (initial, warning)| `"auto"` |
| `fetchpriority=(true)`| (initial, warning)| `"auto"` |
| `fetchpriority=(false)`| (initial, warning)| `"auto"` |
| `fetchpriority=(string 'true')`| (initial, warning)| `"auto"` |
| `fetchpriority=(string 'false')`| (initial, warning)| `"auto"` |
| `fetchpriority=(string 'on')`| (initial, warning)| `"auto"` |
| `fetchpriority=(string 'off')`| (initial, warning)| `"auto"` |
| `fetchpriority=(symbol)`| (initial, warning)| `"auto"` |
| `fetchpriority=(function)`| (initial, warning)| `"auto"` |
| `fetchpriority=(null)`| (initial, warning)| `"auto"` |
| `fetchpriority=(undefined)`| (initial, warning)| `"auto"` |
## `fetchPriority` (on `<link>` inside `<div>`)
| Test Case | Flags | Result |
| --- | --- | --- |
| `fetchPriority=(string)`| (changed)| `"high"` |
| `fetchPriority=(empty string)`| (initial)| `"auto"` |
| `fetchPriority=(array with string)`| (changed)| `"high"` |
| `fetchPriority=(empty array)`| (initial)| `"auto"` |
| `fetchPriority=(object)`| (initial)| `"auto"` |
| `fetchPriority=(numeric string)`| (initial)| `"auto"` |
| `fetchPriority=(-1)`| (initial)| `"auto"` |
| `fetchPriority=(0)`| (initial)| `"auto"` |
| `fetchPriority=(integer)`| (initial)| `"auto"` |
| `fetchPriority=(NaN)`| (initial, warning)| `"auto"` |
| `fetchPriority=(float)`| (initial)| `"auto"` |
| `fetchPriority=(true)`| (initial, warning)| `"auto"` |
| `fetchPriority=(false)`| (initial, warning)| `"auto"` |
| `fetchPriority=(string 'true')`| (initial)| `"auto"` |
| `fetchPriority=(string 'false')`| (initial)| `"auto"` |
| `fetchPriority=(string 'on')`| (initial)| `"auto"` |
| `fetchPriority=(string 'off')`| (initial)| `"auto"` |
| `fetchPriority=(symbol)`| (initial, warning)| `"auto"` |
| `fetchPriority=(function)`| (initial, warning)| `"auto"` |
| `fetchPriority=(null)`| (initial)| `"auto"` |
| `fetchPriority=(undefined)`| (initial)| `"auto"` |
## `fill` (on `<path>` inside `<svg>`)
| Test Case | Flags | Result |
| --- | --- | --- |

View File

@ -573,6 +573,24 @@ const attributes = [
tagName: 'path',
read: getSVGAttribute('externalResourcesRequired'),
},
{
name: 'fetchPriority',
overrideStringValue: 'high',
tagName: 'img',
read: getProperty('fetchPriority'),
},
{
name: 'fetchpriority',
overrideStringValue: 'high',
tagName: 'img',
read: getProperty('fetchPriority'),
},
{
name: 'fetchPriority',
overrideStringValue: 'high',
tagName: 'link',
read: getProperty('fetchPriority'),
},
{
name: 'fill',
containerTagName: 'svg',

View File

@ -60,6 +60,7 @@ const possibleStandardNames = {
draggable: 'draggable',
enctype: 'encType',
enterkeyhint: 'enterKeyHint',
fetchpriority: 'fetchPriority',
for: 'htmlFor',
form: 'form',
formmethod: 'formMethod',