Skip to content

Commit de7d1c9

Browse files
styfleeps1lon
andauthored
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 #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 <[email protected]>
1 parent 81d4ee9 commit de7d1c9

File tree

3 files changed

+94
-0
lines changed

3 files changed

+94
-0
lines changed

fixtures/attribute-behavior/AttributeTableSnapshot.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3348,6 +3348,81 @@
33483348
| `externalResourcesRequired=(null)`| (initial)| `<null>` |
33493349
| `externalResourcesRequired=(undefined)`| (initial)| `<null>` |
33503350

3351+
## `fetchPriority` (on `<img>` inside `<div>`)
3352+
| Test Case | Flags | Result |
3353+
| --- | --- | --- |
3354+
| `fetchPriority=(string)`| (changed)| `"high"` |
3355+
| `fetchPriority=(empty string)`| (initial)| `"auto"` |
3356+
| `fetchPriority=(array with string)`| (changed)| `"high"` |
3357+
| `fetchPriority=(empty array)`| (initial)| `"auto"` |
3358+
| `fetchPriority=(object)`| (initial)| `"auto"` |
3359+
| `fetchPriority=(numeric string)`| (initial)| `"auto"` |
3360+
| `fetchPriority=(-1)`| (initial)| `"auto"` |
3361+
| `fetchPriority=(0)`| (initial)| `"auto"` |
3362+
| `fetchPriority=(integer)`| (initial)| `"auto"` |
3363+
| `fetchPriority=(NaN)`| (initial, warning)| `"auto"` |
3364+
| `fetchPriority=(float)`| (initial)| `"auto"` |
3365+
| `fetchPriority=(true)`| (initial, warning)| `"auto"` |
3366+
| `fetchPriority=(false)`| (initial, warning)| `"auto"` |
3367+
| `fetchPriority=(string 'true')`| (initial)| `"auto"` |
3368+
| `fetchPriority=(string 'false')`| (initial)| `"auto"` |
3369+
| `fetchPriority=(string 'on')`| (initial)| `"auto"` |
3370+
| `fetchPriority=(string 'off')`| (initial)| `"auto"` |
3371+
| `fetchPriority=(symbol)`| (initial, warning)| `"auto"` |
3372+
| `fetchPriority=(function)`| (initial, warning)| `"auto"` |
3373+
| `fetchPriority=(null)`| (initial)| `"auto"` |
3374+
| `fetchPriority=(undefined)`| (initial)| `"auto"` |
3375+
3376+
## `fetchpriority` (on `<img>` inside `<div>`)
3377+
| Test Case | Flags | Result |
3378+
| --- | --- | --- |
3379+
| `fetchpriority=(string)`| (changed, warning)| `"high"` |
3380+
| `fetchpriority=(empty string)`| (initial, warning)| `"auto"` |
3381+
| `fetchpriority=(array with string)`| (changed, warning)| `"high"` |
3382+
| `fetchpriority=(empty array)`| (initial, warning)| `"auto"` |
3383+
| `fetchpriority=(object)`| (initial, warning)| `"auto"` |
3384+
| `fetchpriority=(numeric string)`| (initial, warning)| `"auto"` |
3385+
| `fetchpriority=(-1)`| (initial, warning)| `"auto"` |
3386+
| `fetchpriority=(0)`| (initial, warning)| `"auto"` |
3387+
| `fetchpriority=(integer)`| (initial, warning)| `"auto"` |
3388+
| `fetchpriority=(NaN)`| (initial, warning)| `"auto"` |
3389+
| `fetchpriority=(float)`| (initial, warning)| `"auto"` |
3390+
| `fetchpriority=(true)`| (initial, warning)| `"auto"` |
3391+
| `fetchpriority=(false)`| (initial, warning)| `"auto"` |
3392+
| `fetchpriority=(string 'true')`| (initial, warning)| `"auto"` |
3393+
| `fetchpriority=(string 'false')`| (initial, warning)| `"auto"` |
3394+
| `fetchpriority=(string 'on')`| (initial, warning)| `"auto"` |
3395+
| `fetchpriority=(string 'off')`| (initial, warning)| `"auto"` |
3396+
| `fetchpriority=(symbol)`| (initial, warning)| `"auto"` |
3397+
| `fetchpriority=(function)`| (initial, warning)| `"auto"` |
3398+
| `fetchpriority=(null)`| (initial, warning)| `"auto"` |
3399+
| `fetchpriority=(undefined)`| (initial, warning)| `"auto"` |
3400+
3401+
## `fetchPriority` (on `<link>` inside `<div>`)
3402+
| Test Case | Flags | Result |
3403+
| --- | --- | --- |
3404+
| `fetchPriority=(string)`| (changed)| `"high"` |
3405+
| `fetchPriority=(empty string)`| (initial)| `"auto"` |
3406+
| `fetchPriority=(array with string)`| (changed)| `"high"` |
3407+
| `fetchPriority=(empty array)`| (initial)| `"auto"` |
3408+
| `fetchPriority=(object)`| (initial)| `"auto"` |
3409+
| `fetchPriority=(numeric string)`| (initial)| `"auto"` |
3410+
| `fetchPriority=(-1)`| (initial)| `"auto"` |
3411+
| `fetchPriority=(0)`| (initial)| `"auto"` |
3412+
| `fetchPriority=(integer)`| (initial)| `"auto"` |
3413+
| `fetchPriority=(NaN)`| (initial, warning)| `"auto"` |
3414+
| `fetchPriority=(float)`| (initial)| `"auto"` |
3415+
| `fetchPriority=(true)`| (initial, warning)| `"auto"` |
3416+
| `fetchPriority=(false)`| (initial, warning)| `"auto"` |
3417+
| `fetchPriority=(string 'true')`| (initial)| `"auto"` |
3418+
| `fetchPriority=(string 'false')`| (initial)| `"auto"` |
3419+
| `fetchPriority=(string 'on')`| (initial)| `"auto"` |
3420+
| `fetchPriority=(string 'off')`| (initial)| `"auto"` |
3421+
| `fetchPriority=(symbol)`| (initial, warning)| `"auto"` |
3422+
| `fetchPriority=(function)`| (initial, warning)| `"auto"` |
3423+
| `fetchPriority=(null)`| (initial)| `"auto"` |
3424+
| `fetchPriority=(undefined)`| (initial)| `"auto"` |
3425+
33513426
## `fill` (on `<path>` inside `<svg>`)
33523427
| Test Case | Flags | Result |
33533428
| --- | --- | --- |

fixtures/attribute-behavior/src/attributes.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,24 @@ const attributes = [
573573
tagName: 'path',
574574
read: getSVGAttribute('externalResourcesRequired'),
575575
},
576+
{
577+
name: 'fetchPriority',
578+
overrideStringValue: 'high',
579+
tagName: 'img',
580+
read: getProperty('fetchPriority'),
581+
},
582+
{
583+
name: 'fetchpriority',
584+
overrideStringValue: 'high',
585+
tagName: 'img',
586+
read: getProperty('fetchPriority'),
587+
},
588+
{
589+
name: 'fetchPriority',
590+
overrideStringValue: 'high',
591+
tagName: 'link',
592+
read: getProperty('fetchPriority'),
593+
},
576594
{
577595
name: 'fill',
578596
containerTagName: 'svg',

packages/react-dom-bindings/src/shared/possibleStandardNames.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ const possibleStandardNames = {
6060
draggable: 'draggable',
6161
enctype: 'encType',
6262
enterkeyhint: 'enterKeyHint',
63+
fetchpriority: 'fetchPriority',
6364
for: 'htmlFor',
6465
form: 'form',
6566
formmethod: 'formMethod',

0 commit comments

Comments
 (0)