@@ -10,7 +10,9 @@ export const REACT_ELEMENT_TYPE =
1010 ( typeof Symbol != 'undefined' && Symbol . for && Symbol . for ( 'react.element' ) ) ||
1111 0xeac7 ;
1212
13- const CAMEL_PROPS = / ^ (?: a c c e n t | a l i g n m e n t | a r a b i c | b a s e l i n e | c a p | c l i p (? ! P a t h U ) | c o l o r | f i l l | f l o o d | f o n t | g l y p h (? ! R ) | h o r i z | m a r k e r (? ! H | W | U ) | o v e r l i n e | p a i n t | s t o p | s t r i k e t h r o u g h | s t r o k e | t e x t (? ! L ) | u n d e r l i n e | u n i c o d e | u n i t s | v | v e c t o r | v e r t | w o r d | w r i t i n g | x (? ! C ) ) [ A - Z ] / ;
13+ const CAMEL_PROPS = / ^ (?: a c c e n t | a l i g n m e n t | a r a b i c | b a s e l i n e | c a p | c l i p (? ! P a t h U ) | c o l o r | d o m i n a n t | f i l l | f l o o d | f o n t | g l y p h (? ! R ) | h o r i z | m a r k e r (? ! H | W | U ) | o v e r l i n e | p a i n t | s t o p | s t r i k e t h r o u g h | s t r o k e | t e x t (? ! L ) | u n d e r l i n e | u n i c o d e | u n i t s | v | v e c t o r | v e r t | w o r d | w r i t i n g | x (? ! C ) ) [ A - Z ] / ;
14+
15+ const IS_DOM = typeof document !== 'undefined' ;
1416
1517// Input types for which onchange should not be converted to oninput.
1618// type="file|checkbox|radio", plus "range" in IE11.
@@ -112,12 +114,17 @@ options.vnode = vnode => {
112114
113115 // only normalize props on Element nodes
114116 if ( typeof type === 'string' ) {
117+ const nonCustomElement = type . indexOf ( '-' ) === - 1 ;
115118 normalizedProps = { } ;
116119
117120 for ( let i in props ) {
118121 let value = props [ i ] ;
119122
120- if ( i === 'value' && 'defaultValue' in props && value == null ) {
123+ if ( IS_DOM && i === 'children' && type === 'noscript' ) {
124+ // Emulate React's behavior of not rendering the contents of noscript tags on the client.
125+ continue ;
126+ }
127+ else if ( i === 'value' && 'defaultValue' in props && value == null ) {
121128 // Skip applying value if it is null/undefined and we already set
122129 // a default value
123130 continue ;
@@ -145,7 +152,7 @@ options.vnode = vnode => {
145152 i = 'oninput' ;
146153 } else if ( / ^ o n ( A n i | T r a | T o u | B e f o r e I n p ) / . test ( i ) ) {
147154 i = i . toLowerCase ( ) ;
148- } else if ( CAMEL_PROPS . test ( i ) ) {
155+ } else if ( nonCustomElement && CAMEL_PROPS . test ( i ) ) {
149156 i = i . replace ( / [ A - Z 0 - 9 ] / , '-$&' ) . toLowerCase ( ) ;
150157 } else if ( value === null ) {
151158 value = undefined ;
@@ -181,12 +188,12 @@ options.vnode = vnode => {
181188 }
182189
183190 vnode . props = normalizedProps ;
184- }
185191
186- if ( type && props . class != props . className ) {
187- classNameDescriptor . enumerable = 'className' in props ;
188- if ( props . className != null ) normalizedProps . class = props . className ;
189- Object . defineProperty ( normalizedProps , 'className' , classNameDescriptor ) ;
192+ if ( props . class != props . className ) {
193+ classNameDescriptor . enumerable = 'className' in props ;
194+ if ( props . className != null ) normalizedProps . class = props . className ;
195+ Object . defineProperty ( normalizedProps , 'className' , classNameDescriptor ) ;
196+ }
190197 }
191198
192199 vnode . $$typeof = REACT_ELEMENT_TYPE ;
0 commit comments