Skip to content

Commit

Permalink
Add fetchPriority to <img> and <link> (facebook#25927)
Browse files Browse the repository at this point in the history
<!--
  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 facebook#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>
  • Loading branch information
styfle and eps1lon committed Dec 23, 2022
1 parent 81d4ee9 commit de7d1c9
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 0 deletions.
75 changes: 75 additions & 0 deletions fixtures/attribute-behavior/AttributeTableSnapshot.md
Expand Up @@ -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 |
| --- | --- | --- |
Expand Down
18 changes: 18 additions & 0 deletions fixtures/attribute-behavior/src/attributes.js
Expand Up @@ -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',
Expand Down
Expand Up @@ -60,6 +60,7 @@ const possibleStandardNames = {
draggable: 'draggable',
enctype: 'encType',
enterkeyhint: 'enterKeyHint',
fetchpriority: 'fetchPriority',
for: 'htmlFor',
form: 'form',
formmethod: 'formMethod',
Expand Down

0 comments on commit de7d1c9

Please sign in to comment.