@@ -42,8 +42,6 @@ export type PropertyInfo = {
42
42
+ acceptsBooleans : boolean ,
43
43
+ attributeName : string ,
44
44
+ attributeNamespace : string | null ,
45
- + mustUseProperty : boolean ,
46
- + propertyName : string ,
47
45
+ type : PropertyType ,
48
46
+ sanitizeURL : boolean ,
49
47
+ removeEmptyString : boolean ,
@@ -55,9 +53,7 @@ export function getPropertyInfo(name: string): PropertyInfo | null {
55
53
56
54
// $FlowFixMe[missing-this-annot]
57
55
function PropertyInfoRecord (
58
- name : string ,
59
56
type : PropertyType ,
60
- mustUseProperty : boolean ,
61
57
attributeName : string ,
62
58
attributeNamespace : string | null ,
63
59
sanitizeURL : boolean ,
@@ -69,8 +65,6 @@ function PropertyInfoRecord(
69
65
type === OVERLOADED_BOOLEAN ;
70
66
this . attributeName = attributeName ;
71
67
this . attributeNamespace = attributeNamespace ;
72
- this . mustUseProperty = mustUseProperty ;
73
- this . propertyName = name ;
74
68
this . type = type ;
75
69
this . sanitizeURL = sanitizeURL ;
76
70
this . removeEmptyString = removeEmptyString ;
@@ -91,9 +85,7 @@ const properties: {[string]: $FlowFixMe} = {};
91
85
] . forEach ( ( [ name , attributeName ] ) => {
92
86
// $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
93
87
properties [ name ] = new PropertyInfoRecord (
94
- name ,
95
88
STRING ,
96
- false , // mustUseProperty
97
89
attributeName , // attributeName
98
90
null , // attributeNamespace
99
91
false , // sanitizeURL
@@ -107,9 +99,7 @@ const properties: {[string]: $FlowFixMe} = {};
107
99
[ 'contentEditable' , 'draggable' , 'spellCheck' , 'value' ] . forEach ( name => {
108
100
// $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
109
101
properties [ name ] = new PropertyInfoRecord (
110
- name ,
111
102
BOOLEANISH_STRING ,
112
- false , // mustUseProperty
113
103
name . toLowerCase ( ) , // attributeName
114
104
null , // attributeNamespace
115
105
false , // sanitizeURL
@@ -129,9 +119,7 @@ const properties: {[string]: $FlowFixMe} = {};
129
119
] . forEach ( name => {
130
120
// $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
131
121
properties [ name ] = new PropertyInfoRecord (
132
- name ,
133
122
BOOLEANISH_STRING ,
134
- false , // mustUseProperty
135
123
name , // attributeName
136
124
null , // attributeNamespace
137
125
false , // sanitizeURL
@@ -170,42 +158,14 @@ const properties: {[string]: $FlowFixMe} = {};
170
158
] . forEach ( name => {
171
159
// $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
172
160
properties [ name ] = new PropertyInfoRecord (
173
- name ,
174
161
BOOLEAN ,
175
- false , // mustUseProperty
176
162
name . toLowerCase ( ) , // attributeName
177
163
null , // attributeNamespace
178
164
false , // sanitizeURL
179
165
false , // removeEmptyString
180
166
) ;
181
167
} ) ;
182
168
183
- // These are the few React props that we set as DOM properties
184
- // rather than attributes. These are all booleans.
185
- [
186
- 'checked' ,
187
- // Note: `option.selected` is not updated if `select.multiple` is
188
- // disabled with `removeAttribute`. We have special logic for handling this.
189
- 'multiple' ,
190
- 'muted' ,
191
- 'selected' ,
192
-
193
- // NOTE: if you add a camelCased prop to this list,
194
- // you'll need to set attributeName to name.toLowerCase()
195
- // instead in the assignment below.
196
- ] . forEach ( name => {
197
- // $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
198
- properties [ name ] = new PropertyInfoRecord (
199
- name ,
200
- BOOLEAN ,
201
- true , // mustUseProperty
202
- name , // attributeName
203
- null , // attributeNamespace
204
- false , // sanitizeURL
205
- false , // removeEmptyString
206
- ) ;
207
- } ) ;
208
-
209
169
// These are HTML attributes that are "overloaded booleans": they behave like
210
170
// booleans, but can also accept a string value.
211
171
[
@@ -218,9 +178,7 @@ const properties: {[string]: $FlowFixMe} = {};
218
178
] . forEach ( name => {
219
179
// $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
220
180
properties [ name ] = new PropertyInfoRecord (
221
- name ,
222
181
OVERLOADED_BOOLEAN ,
223
- false , // mustUseProperty
224
182
name , // attributeName
225
183
null , // attributeNamespace
226
184
false , // sanitizeURL
@@ -241,9 +199,7 @@ const properties: {[string]: $FlowFixMe} = {};
241
199
] . forEach ( name => {
242
200
// $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
243
201
properties [ name ] = new PropertyInfoRecord (
244
- name ,
245
202
POSITIVE_NUMERIC ,
246
- false , // mustUseProperty
247
203
name , // attributeName
248
204
null , // attributeNamespace
249
205
false , // sanitizeURL
@@ -255,9 +211,7 @@ const properties: {[string]: $FlowFixMe} = {};
255
211
[ 'rowSpan' , 'start' ] . forEach ( name => {
256
212
// $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
257
213
properties [ name ] = new PropertyInfoRecord (
258
- name ,
259
214
NUMERIC ,
260
- false , // mustUseProperty
261
215
name . toLowerCase ( ) , // attributeName
262
216
null , // attributeNamespace
263
217
false , // sanitizeURL
@@ -356,9 +310,7 @@ const capitalize = (token: string) => token[1].toUpperCase();
356
310
const name = attributeName . replace ( CAMELIZE , capitalize ) ;
357
311
// $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
358
312
properties [ name ] = new PropertyInfoRecord (
359
- name ,
360
313
STRING ,
361
- false , // mustUseProperty
362
314
attributeName ,
363
315
null , // attributeNamespace
364
316
false , // sanitizeURL
@@ -382,9 +334,7 @@ const capitalize = (token: string) => token[1].toUpperCase();
382
334
const name = attributeName . replace ( CAMELIZE , capitalize ) ;
383
335
// $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
384
336
properties [ name ] = new PropertyInfoRecord (
385
- name ,
386
337
STRING ,
387
- false , // mustUseProperty
388
338
attributeName ,
389
339
'http://www.w3.org/1999/xlink' ,
390
340
false , // sanitizeURL
@@ -405,9 +355,7 @@ const capitalize = (token: string) => token[1].toUpperCase();
405
355
const name = attributeName . replace ( CAMELIZE , capitalize ) ;
406
356
// $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
407
357
properties [ name ] = new PropertyInfoRecord (
408
- name ,
409
358
STRING ,
410
- false , // mustUseProperty
411
359
attributeName ,
412
360
'http://www.w3.org/XML/1998/namespace' ,
413
361
false , // sanitizeURL
@@ -421,9 +369,7 @@ const capitalize = (token: string) => token[1].toUpperCase();
421
369
[ 'tabIndex' , 'crossOrigin' ] . forEach ( attributeName => {
422
370
// $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
423
371
properties [ attributeName ] = new PropertyInfoRecord (
424
- attributeName ,
425
372
STRING ,
426
- false , // mustUseProperty
427
373
attributeName . toLowerCase ( ) , // attributeName
428
374
null , // attributeNamespace
429
375
false , // sanitizeURL
@@ -436,9 +382,7 @@ const capitalize = (token: string) => token[1].toUpperCase();
436
382
const xlinkHref = 'xlinkHref' ;
437
383
// $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
438
384
properties [ xlinkHref ] = new PropertyInfoRecord (
439
- 'xlinkHref' ,
440
385
STRING ,
441
- false , // mustUseProperty
442
386
'xlink:href' ,
443
387
'http://www.w3.org/1999/xlink' ,
444
388
true , // sanitizeURL
@@ -448,9 +392,7 @@ properties[xlinkHref] = new PropertyInfoRecord(
448
392
const formAction = 'formAction' ;
449
393
// $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
450
394
properties [ formAction ] = new PropertyInfoRecord (
451
- 'formAction' ,
452
395
STRING ,
453
- false , // mustUseProperty
454
396
'formaction' , // attributeName
455
397
null , // attributeNamespace
456
398
true , // sanitizeURL
@@ -460,9 +402,7 @@ properties[formAction] = new PropertyInfoRecord(
460
402
[ 'src' , 'href' , 'action' ] . forEach ( attributeName => {
461
403
// $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
462
404
properties [ attributeName ] = new PropertyInfoRecord (
463
- attributeName ,
464
405
STRING ,
465
- false , // mustUseProperty
466
406
attributeName . toLowerCase ( ) , // attributeName
467
407
null , // attributeNamespace
468
408
true , // sanitizeURL
0 commit comments