Skip to content

Commit cfe998b

Browse files
committed
Limit the meaning of "custom element" to not include is
Effectively this means that you can't use custom properties/events, other than the ones React knows about on `is` extensions. This is unfortunate but there's too many paths that are forked in inconsistent ways. I think the solution is to let all React elements set unknown properties in the same way as this flag but that's a bigger change than this flag implies. Since `is` is not universally supported yet anyway, this doesn't seem like a huge loss. Attributes still work.
1 parent 5ddcfd2 commit cfe998b

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

packages/react-dom-bindings/src/server/ReactDOMServerFormatConfig.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2604,7 +2604,7 @@ export function pushStartInstance(
26042604
);
26052605
}
26062606
default: {
2607-
if (type.indexOf('-') === -1 && typeof props.is !== 'string') {
2607+
if (type.indexOf('-') === -1) {
26082608
// Generic element
26092609
return pushStartGenericElement(target, props, type);
26102610
} else {

packages/react-dom-bindings/src/shared/ReactDOMUnknownPropertyHook.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ function warnUnknownProperties(type, props, eventRegistry) {
308308
}
309309

310310
export function validateProperties(type, props, eventRegistry) {
311-
if (isCustomElement(type, props)) {
311+
if (isCustomElement(type, props) || typeof props.is === 'string') {
312312
return;
313313
}
314314
warnUnknownProperties(type, props, eventRegistry);

packages/react-dom-bindings/src/shared/isCustomElement.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
function isCustomElement(tagName: string, props: Object): boolean {
1111
if (tagName.indexOf('-') === -1) {
12-
return typeof props.is === 'string';
12+
return false;
1313
}
1414
switch (tagName) {
1515
// These are reserved SVG and MathML elements.

0 commit comments

Comments
 (0)