Skip to content

Commit f29ce9d

Browse files
eps1lonzhengjitf
authored andcommitted
Add imageSizes and imageSrcSet to know props (facebook#22550)
* feat(react-dom): Add `imageSrcSet` * feat(react-dom): Add `imageSizes`
1 parent 1de4ab2 commit f29ce9d

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed

fixtures/attribute-behavior/AttributeTableSnapshot.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5248,6 +5248,56 @@
52485248
| `imageRendering=(null)`| (initial)| `<null>` |
52495249
| `imageRendering=(undefined)`| (initial)| `<null>` |
52505250

5251+
## `imageSizes` (on `<link>` inside `<div>`)
5252+
| Test Case | Flags | Result |
5253+
| --- | --- | --- |
5254+
| `imageSizes=(string)`| (changed)| `"a string"` |
5255+
| `imageSizes=(empty string)`| (initial)| `<empty string>` |
5256+
| `imageSizes=(array with string)`| (changed)| `"string"` |
5257+
| `imageSizes=(empty array)`| (initial)| `<empty string>` |
5258+
| `imageSizes=(object)`| (changed)| `"result of toString()"` |
5259+
| `imageSizes=(numeric string)`| (changed)| `"42"` |
5260+
| `imageSizes=(-1)`| (changed)| `"-1"` |
5261+
| `imageSizes=(0)`| (changed)| `"0"` |
5262+
| `imageSizes=(integer)`| (changed)| `"1"` |
5263+
| `imageSizes=(NaN)`| (changed, warning)| `"NaN"` |
5264+
| `imageSizes=(float)`| (changed)| `"99.99"` |
5265+
| `imageSizes=(true)`| (initial, warning)| `<empty string>` |
5266+
| `imageSizes=(false)`| (initial, warning)| `<empty string>` |
5267+
| `imageSizes=(string 'true')`| (changed)| `"true"` |
5268+
| `imageSizes=(string 'false')`| (changed)| `"false"` |
5269+
| `imageSizes=(string 'on')`| (changed)| `"on"` |
5270+
| `imageSizes=(string 'off')`| (changed)| `"off"` |
5271+
| `imageSizes=(symbol)`| (initial, warning)| `<empty string>` |
5272+
| `imageSizes=(function)`| (initial, warning)| `<empty string>` |
5273+
| `imageSizes=(null)`| (initial)| `<empty string>` |
5274+
| `imageSizes=(undefined)`| (initial)| `<empty string>` |
5275+
5276+
## `imageSrcSet` (on `<link>` inside `<div>`)
5277+
| Test Case | Flags | Result |
5278+
| --- | --- | --- |
5279+
| `imageSrcSet=(string)`| (changed)| `"a string"` |
5280+
| `imageSrcSet=(empty string)`| (initial)| `<empty string>` |
5281+
| `imageSrcSet=(array with string)`| (changed)| `"string"` |
5282+
| `imageSrcSet=(empty array)`| (initial)| `<empty string>` |
5283+
| `imageSrcSet=(object)`| (changed)| `"result of toString()"` |
5284+
| `imageSrcSet=(numeric string)`| (changed)| `"42"` |
5285+
| `imageSrcSet=(-1)`| (changed)| `"-1"` |
5286+
| `imageSrcSet=(0)`| (changed)| `"0"` |
5287+
| `imageSrcSet=(integer)`| (changed)| `"1"` |
5288+
| `imageSrcSet=(NaN)`| (changed, warning)| `"NaN"` |
5289+
| `imageSrcSet=(float)`| (changed)| `"99.99"` |
5290+
| `imageSrcSet=(true)`| (initial, warning)| `<empty string>` |
5291+
| `imageSrcSet=(false)`| (initial, warning)| `<empty string>` |
5292+
| `imageSrcSet=(string 'true')`| (changed)| `"true"` |
5293+
| `imageSrcSet=(string 'false')`| (changed)| `"false"` |
5294+
| `imageSrcSet=(string 'on')`| (changed)| `"on"` |
5295+
| `imageSrcSet=(string 'off')`| (changed)| `"off"` |
5296+
| `imageSrcSet=(symbol)`| (initial, warning)| `<empty string>` |
5297+
| `imageSrcSet=(function)`| (initial, warning)| `<empty string>` |
5298+
| `imageSrcSet=(null)`| (initial)| `<empty string>` |
5299+
| `imageSrcSet=(undefined)`| (initial)| `<empty string>` |
5300+
52515301
## `in` (on `<feBlend>` inside `<svg>`)
52525302
| Test Case | Flags | Result |
52535303
| --- | --- | --- |

fixtures/attribute-behavior/src/attributes.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -937,6 +937,8 @@ const attributes = [
937937
tagName: 'svg',
938938
read: getSVGAttribute('image-rendering'),
939939
},
940+
{name: 'imageSizes', tagName: 'link', read: getProperty('imageSizes')},
941+
{name: 'imageSrcSet', tagName: 'link', read: getProperty('imageSrcset')},
940942
{
941943
name: 'in',
942944
read: getSVGAttribute('in'),

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ const possibleStandardNames = {
7979
'http-equiv': 'httpEquiv',
8080
icon: 'icon',
8181
id: 'id',
82+
imagesizes: 'imageSizes',
83+
imagesrcset: 'imageSrcSet',
8284
innerhtml: 'innerHTML',
8385
inputmode: 'inputMode',
8486
integrity: 'integrity',

0 commit comments

Comments
 (0)