Ignore function and symbol values on custom-elements on the server (#21157)

This commit is contained in:
Sebastian Markbåge authored and GitHub committed 2021-03-31 18:17:42 -07:00
1 parent 588db2e1fc
commit a423a01223
2 files changed
+11 -2

No files matched your search

+6 -1
View File
@@ -71,7 +71,12 @@ export function createMarkupForCustomAttribute(
name: string,
value: mixed,
): string {
if (!isAttributeNameSafe(name) || value == null) {
if (
!isAttributeNameSafe(name) ||
value == null ||
typeof value === 'function' ||
typeof value === 'symbol'
) {
return '';
}
return name + '=' + quoteAttributeValueForBrowser(value);
@@ -1070,7 +1070,11 @@ function pushStartCustomElement(
// Ignored. These are built-in to React on the client.
break;
default:
if (isAttributeNameSafe(propKey)) {
if (
isAttributeNameSafe(propKey) &&
typeof propValue !== 'function' &&
typeof propValue !== 'symbol'
) {
target.push(
attributeSeparator,
stringToChunk(propKey),