Skip to content

Commit

Permalink
Add imageSizes and imageSrcSet to know props (#22550)
Browse files Browse the repository at this point in the history
* feat(react-dom): Add `imageSrcSet`

* feat(react-dom): Add `imageSizes`
  • Loading branch information
eps1lon authored Nov 25, 2021
1 parent cbc484b commit ca106a0
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
50 changes: 50 additions & 0 deletions fixtures/attribute-behavior/AttributeTableSnapshot.md
Original file line number Diff line number Diff line change
Expand Up @@ -5248,6 +5248,56 @@
| `imageRendering=(null)`| (initial)| `<null>` |
| `imageRendering=(undefined)`| (initial)| `<null>` |

## `imageSizes` (on `<link>` inside `<div>`)
| Test Case | Flags | Result |
| --- | --- | --- |
| `imageSizes=(string)`| (changed)| `"a string"` |
| `imageSizes=(empty string)`| (initial)| `<empty string>` |
| `imageSizes=(array with string)`| (changed)| `"string"` |
| `imageSizes=(empty array)`| (initial)| `<empty string>` |
| `imageSizes=(object)`| (changed)| `"result of toString()"` |
| `imageSizes=(numeric string)`| (changed)| `"42"` |
| `imageSizes=(-1)`| (changed)| `"-1"` |
| `imageSizes=(0)`| (changed)| `"0"` |
| `imageSizes=(integer)`| (changed)| `"1"` |
| `imageSizes=(NaN)`| (changed, warning)| `"NaN"` |
| `imageSizes=(float)`| (changed)| `"99.99"` |
| `imageSizes=(true)`| (initial, warning)| `<empty string>` |
| `imageSizes=(false)`| (initial, warning)| `<empty string>` |
| `imageSizes=(string 'true')`| (changed)| `"true"` |
| `imageSizes=(string 'false')`| (changed)| `"false"` |
| `imageSizes=(string 'on')`| (changed)| `"on"` |
| `imageSizes=(string 'off')`| (changed)| `"off"` |
| `imageSizes=(symbol)`| (initial, warning)| `<empty string>` |
| `imageSizes=(function)`| (initial, warning)| `<empty string>` |
| `imageSizes=(null)`| (initial)| `<empty string>` |
| `imageSizes=(undefined)`| (initial)| `<empty string>` |

## `imageSrcSet` (on `<link>` inside `<div>`)
| Test Case | Flags | Result |
| --- | --- | --- |
| `imageSrcSet=(string)`| (changed)| `"a string"` |
| `imageSrcSet=(empty string)`| (initial)| `<empty string>` |
| `imageSrcSet=(array with string)`| (changed)| `"string"` |
| `imageSrcSet=(empty array)`| (initial)| `<empty string>` |
| `imageSrcSet=(object)`| (changed)| `"result of toString()"` |
| `imageSrcSet=(numeric string)`| (changed)| `"42"` |
| `imageSrcSet=(-1)`| (changed)| `"-1"` |
| `imageSrcSet=(0)`| (changed)| `"0"` |
| `imageSrcSet=(integer)`| (changed)| `"1"` |
| `imageSrcSet=(NaN)`| (changed, warning)| `"NaN"` |
| `imageSrcSet=(float)`| (changed)| `"99.99"` |
| `imageSrcSet=(true)`| (initial, warning)| `<empty string>` |
| `imageSrcSet=(false)`| (initial, warning)| `<empty string>` |
| `imageSrcSet=(string 'true')`| (changed)| `"true"` |
| `imageSrcSet=(string 'false')`| (changed)| `"false"` |
| `imageSrcSet=(string 'on')`| (changed)| `"on"` |
| `imageSrcSet=(string 'off')`| (changed)| `"off"` |
| `imageSrcSet=(symbol)`| (initial, warning)| `<empty string>` |
| `imageSrcSet=(function)`| (initial, warning)| `<empty string>` |
| `imageSrcSet=(null)`| (initial)| `<empty string>` |
| `imageSrcSet=(undefined)`| (initial)| `<empty string>` |

## `in` (on `<feBlend>` inside `<svg>`)
| Test Case | Flags | Result |
| --- | --- | --- |
Expand Down
2 changes: 2 additions & 0 deletions fixtures/attribute-behavior/src/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -937,6 +937,8 @@ const attributes = [
tagName: 'svg',
read: getSVGAttribute('image-rendering'),
},
{name: 'imageSizes', tagName: 'link', read: getProperty('imageSizes')},
{name: 'imageSrcSet', tagName: 'link', read: getProperty('imageSrcset')},
{
name: 'in',
read: getSVGAttribute('in'),
Expand Down
2 changes: 2 additions & 0 deletions packages/react-dom/src/shared/possibleStandardNames.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ const possibleStandardNames = {
'http-equiv': 'httpEquiv',
icon: 'icon',
id: 'id',
imagesizes: 'imageSizes',
imagesrcset: 'imageSrcSet',
innerhtml: 'innerHTML',
inputmode: 'inputMode',
integrity: 'integrity',
Expand Down

0 comments on commit ca106a0

Please sign in to comment.