Skip to content

Commit ab7e2c2

Browse files
feat(react-property): build HTML overloaded boolean properties JSON
These are React properties
1 parent 329593c commit ab7e2c2

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

packages/react-property/scripts/build.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ const attributes = [];
7272
*/
7373
const booleanProperties = ['autoFocus'];
7474

75+
/**
76+
* HTML attributes that behave like booleans but can also accept a string value.
77+
*
78+
* @see https://github.com/facebook/react/blob/15-stable/src/renderers/dom/shared/DOMProperty.js#L190-L193
79+
*/
80+
const overloadedBooleanProperties = [];
81+
7582
Object.keys(DOMProperty.getPossibleStandardName).forEach(attributeName => {
7683
const propertyName = DOMProperty.getPossibleStandardName[attributeName];
7784

@@ -81,8 +88,12 @@ Object.keys(DOMProperty.getPossibleStandardName).forEach(attributeName => {
8188

8289
const property = DOMProperty.properties[propertyName];
8390

84-
if (property && property.hasBooleanValue) {
85-
booleanProperties.push(propertyName);
91+
if (property) {
92+
if (property.hasBooleanValue) {
93+
booleanProperties.push(propertyName);
94+
} else if (property.hasOverloadedBooleanValue) {
95+
overloadedBooleanProperties.push(propertyName);
96+
}
8697
}
8798

8899
attributes.push(attributeName);
@@ -102,3 +113,8 @@ fs.writeFileSync(
102113
path.resolve(HTML_DIR, 'boolean-properties.json'),
103114
JSON.stringify(booleanProperties)
104115
);
116+
117+
fs.writeFileSync(
118+
path.resolve(HTML_DIR, 'overloaded-boolean-properties.json'),
119+
JSON.stringify(overloadedBooleanProperties)
120+
);

0 commit comments

Comments
 (0)