Skip to content

Commit 37e54fc

Browse files
sebmarkbagekoto
authored andcommitted
Ignore function and symbol values on custom-elements on the server (facebook#21157)
1 parent 8800d72 commit 37e54fc

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

packages/react-dom/src/server/DOMMarkupOperations.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,12 @@ export function createMarkupForCustomAttribute(
7171
name: string,
7272
value: mixed,
7373
): string {
74-
if (!isAttributeNameSafe(name) || value == null) {
74+
if (
75+
!isAttributeNameSafe(name) ||
76+
value == null ||
77+
typeof value === 'function' ||
78+
typeof value === 'symbol'
79+
) {
7580
return '';
7681
}
7782
return name + '=' + quoteAttributeValueForBrowser(value);

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

+5-1
Original file line numberDiff line numberDiff line change
@@ -1070,7 +1070,11 @@ function pushStartCustomElement(
10701070
// Ignored. These are built-in to React on the client.
10711071
break;
10721072
default:
1073-
if (isAttributeNameSafe(propKey)) {
1073+
if (
1074+
isAttributeNameSafe(propKey) &&
1075+
typeof propValue !== 'function' &&
1076+
typeof propValue !== 'symbol'
1077+
) {
10741078
target.push(
10751079
attributeSeparator,
10761080
stringToChunk(propKey),

0 commit comments

Comments
 (0)