@@ -3926,48 +3926,51 @@ function writeStyleResourceAttributeInJS(
3926
3926
return ;
3927
3927
3928
3928
// Attribute renames
3929
- case 'className ':
3929
+ case 'className ': {
3930
3930
attributeName = 'class ';
3931
+ if ( __DEV__ ) {
3932
+ checkAttributeStringCoercion ( value , attributeName ) ;
3933
+ }
3934
+ attributeValue = '' + ( value : any ) ;
3931
3935
break ;
3932
-
3936
+ }
3933
3937
// Booleans
3934
- case 'hidden ':
3938
+ case 'hidden ': {
3935
3939
if ( value === false ) {
3936
3940
return ;
3937
3941
}
3938
3942
attributeValue = '';
3939
3943
break ;
3940
-
3944
+ }
3941
3945
// Santized URLs
3942
3946
case 'src ':
3943
3947
case 'href ': {
3948
+ value = sanitizeURL ( value ) ;
3944
3949
if ( __DEV__ ) {
3945
3950
checkAttributeStringCoercion ( value , attributeName ) ;
3946
3951
}
3947
- value = sanitizeURL ( value ) ;
3952
+ attributeValue = '' + ( value : any ) ;
3948
3953
break ;
3949
3954
}
3950
3955
default : {
3956
+ if (
3957
+ // unrecognized event handlers are not SSR'd and we (apparently)
3958
+ // use on* as hueristic for these handler props
3959
+ name . length > 2 &&
3960
+ ( name [ 0 ] === 'o' || name [ 0 ] === 'O' ) &&
3961
+ ( name [ 1 ] === 'n' || name [ 1 ] === 'N' )
3962
+ ) {
3963
+ return ;
3964
+ }
3951
3965
if ( ! isAttributeNameSafe ( name ) ) {
3952
3966
return ;
3953
3967
}
3968
+ if ( __DEV__ ) {
3969
+ checkAttributeStringCoercion ( value , attributeName ) ;
3970
+ }
3971
+ attributeValue = '' + ( value : any ) ;
3954
3972
}
3955
3973
}
3956
-
3957
- if (
3958
- // shouldIgnoreAttribute
3959
- // We have already filtered out null/undefined and reserved words.
3960
- name . length > 2 &&
3961
- ( name [ 0 ] === 'o' || name [ 0 ] === 'O' ) &&
3962
- ( name [ 1 ] === 'n' || name [ 1 ] === 'N' )
3963
- ) {
3964
- return ;
3965
- }
3966
-
3967
- if ( __DEV__ ) {
3968
- checkAttributeStringCoercion ( value , attributeName ) ;
3969
- }
3970
- attributeValue = '' + ( value : any ) ;
3971
3974
writeChunk ( destination , arrayInterstitial ) ;
3972
3975
writeChunk (
3973
3976
destination ,
@@ -4119,48 +4122,53 @@ function writeStyleResourceAttributeInAttr(
4119
4122
return ;
4120
4123
4121
4124
// Attribute renames
4122
- case 'className ':
4125
+ case 'className ': {
4123
4126
attributeName = 'class ';
4127
+ if ( __DEV__ ) {
4128
+ checkAttributeStringCoercion ( value , attributeName ) ;
4129
+ }
4130
+ attributeValue = '' + ( value : any ) ;
4124
4131
break ;
4132
+ }
4125
4133
4126
4134
// Booleans
4127
- case 'hidden ':
4135
+ case 'hidden ': {
4128
4136
if ( value === false ) {
4129
4137
return ;
4130
4138
}
4131
4139
attributeValue = '';
4132
4140
break ;
4141
+ }
4133
4142
4134
4143
// Santized URLs
4135
4144
case 'src ':
4136
4145
case 'href ': {
4146
+ value = sanitizeURL ( value ) ;
4137
4147
if ( __DEV__ ) {
4138
4148
checkAttributeStringCoercion ( value , attributeName ) ;
4139
4149
}
4140
- value = sanitizeURL ( value ) ;
4150
+ attributeValue = '' + ( value : any ) ;
4141
4151
break ;
4142
4152
}
4143
4153
default : {
4154
+ if (
4155
+ // unrecognized event handlers are not SSR'd and we (apparently)
4156
+ // use on* as hueristic for these handler props
4157
+ name . length > 2 &&
4158
+ ( name [ 0 ] === 'o' || name [ 0 ] === 'O' ) &&
4159
+ ( name [ 1 ] === 'n' || name [ 1 ] === 'N' )
4160
+ ) {
4161
+ return ;
4162
+ }
4144
4163
if ( ! isAttributeNameSafe ( name ) ) {
4145
4164
return ;
4146
4165
}
4166
+ if ( __DEV__ ) {
4167
+ checkAttributeStringCoercion ( value , attributeName ) ;
4168
+ }
4169
+ attributeValue = '' + ( value : any ) ;
4147
4170
}
4148
4171
}
4149
-
4150
- if (
4151
- // shouldIgnoreAttribute
4152
- // We have already filtered out null/undefined and reserved words.
4153
- name . length > 2 &&
4154
- ( name [ 0 ] === 'o' || name [ 0 ] === 'O' ) &&
4155
- ( name [ 1 ] === 'n' || name [ 1 ] === 'N' )
4156
- ) {
4157
- return ;
4158
- }
4159
-
4160
- if ( __DEV__ ) {
4161
- checkAttributeStringCoercion ( value , attributeName ) ;
4162
- }
4163
- attributeValue = '' + ( value : any ) ;
4164
4172
writeChunk ( destination , arrayInterstitial ) ;
4165
4173
writeChunk (
4166
4174
destination ,
0 commit comments