mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Revert "Fix logic around attribute seralization (#26526)"
This reverts commit 4a1cc2ddd0.
This commit is contained in:
@@ -3926,51 +3926,48 @@ function writeStyleResourceAttributeInJS(
|
||||
return;
|
||||
|
||||
// Attribute renames
|
||||
case 'className': {
|
||||
case 'className':
|
||||
attributeName = 'class';
|
||||
if (__DEV__) {
|
||||
checkAttributeStringCoercion(value, attributeName);
|
||||
}
|
||||
attributeValue = '' + (value: any);
|
||||
break;
|
||||
}
|
||||
|
||||
// Booleans
|
||||
case 'hidden': {
|
||||
case 'hidden':
|
||||
if (value === false) {
|
||||
return;
|
||||
}
|
||||
attributeValue = '';
|
||||
break;
|
||||
}
|
||||
|
||||
// Santized URLs
|
||||
case 'src':
|
||||
case 'href': {
|
||||
value = sanitizeURL(value);
|
||||
if (__DEV__) {
|
||||
checkAttributeStringCoercion(value, attributeName);
|
||||
}
|
||||
attributeValue = '' + (value: any);
|
||||
value = sanitizeURL(value);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
if (
|
||||
// unrecognized event handlers are not SSR'd and we (apparently)
|
||||
// use on* as hueristic for these handler props
|
||||
name.length > 2 &&
|
||||
(name[0] === 'o' || name[0] === 'O') &&
|
||||
(name[1] === 'n' || name[1] === 'N')
|
||||
) {
|
||||
return;
|
||||
}
|
||||
if (!isAttributeNameSafe(name)) {
|
||||
return;
|
||||
}
|
||||
if (__DEV__) {
|
||||
checkAttributeStringCoercion(value, attributeName);
|
||||
}
|
||||
attributeValue = '' + (value: any);
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
// shouldIgnoreAttribute
|
||||
// We have already filtered out null/undefined and reserved words.
|
||||
name.length > 2 &&
|
||||
(name[0] === 'o' || name[0] === 'O') &&
|
||||
(name[1] === 'n' || name[1] === 'N')
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (__DEV__) {
|
||||
checkAttributeStringCoercion(value, attributeName);
|
||||
}
|
||||
attributeValue = '' + (value: any);
|
||||
writeChunk(destination, arrayInterstitial);
|
||||
writeChunk(
|
||||
destination,
|
||||
@@ -4122,53 +4119,48 @@ function writeStyleResourceAttributeInAttr(
|
||||
return;
|
||||
|
||||
// Attribute renames
|
||||
case 'className': {
|
||||
case 'className':
|
||||
attributeName = 'class';
|
||||
if (__DEV__) {
|
||||
checkAttributeStringCoercion(value, attributeName);
|
||||
}
|
||||
attributeValue = '' + (value: any);
|
||||
break;
|
||||
}
|
||||
|
||||
// Booleans
|
||||
case 'hidden': {
|
||||
case 'hidden':
|
||||
if (value === false) {
|
||||
return;
|
||||
}
|
||||
attributeValue = '';
|
||||
break;
|
||||
}
|
||||
|
||||
// Santized URLs
|
||||
case 'src':
|
||||
case 'href': {
|
||||
value = sanitizeURL(value);
|
||||
if (__DEV__) {
|
||||
checkAttributeStringCoercion(value, attributeName);
|
||||
}
|
||||
attributeValue = '' + (value: any);
|
||||
value = sanitizeURL(value);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
if (
|
||||
// unrecognized event handlers are not SSR'd and we (apparently)
|
||||
// use on* as hueristic for these handler props
|
||||
name.length > 2 &&
|
||||
(name[0] === 'o' || name[0] === 'O') &&
|
||||
(name[1] === 'n' || name[1] === 'N')
|
||||
) {
|
||||
return;
|
||||
}
|
||||
if (!isAttributeNameSafe(name)) {
|
||||
return;
|
||||
}
|
||||
if (__DEV__) {
|
||||
checkAttributeStringCoercion(value, attributeName);
|
||||
}
|
||||
attributeValue = '' + (value: any);
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
// shouldIgnoreAttribute
|
||||
// We have already filtered out null/undefined and reserved words.
|
||||
name.length > 2 &&
|
||||
(name[0] === 'o' || name[0] === 'O') &&
|
||||
(name[1] === 'n' || name[1] === 'N')
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (__DEV__) {
|
||||
checkAttributeStringCoercion(value, attributeName);
|
||||
}
|
||||
attributeValue = '' + (value: any);
|
||||
writeChunk(destination, arrayInterstitial);
|
||||
writeChunk(
|
||||
destination,
|
||||
|
||||
Reference in New Issue
Block a user