File tree Expand file tree Collapse file tree 4 files changed +11
-10
lines changed Expand file tree Collapse file tree 4 files changed +11
-10
lines changed Original file line number Diff line number Diff line change 4
4
UNSAFE_NAME ,
5
5
NAMESPACE_REPLACE_REGEX ,
6
6
HTML_LOWER_CASE ,
7
+ HTML_ENUMERATED ,
7
8
SVG_CAMEL_CASE ,
8
9
createComponent
9
10
} from './lib/util.js' ;
@@ -623,7 +624,10 @@ function _renderToString(
623
624
name = name . replace ( NAMESPACE_REPLACE_REGEX , '$1:$2' ) . toLowerCase ( ) ;
624
625
} else if ( UNSAFE_NAME . test ( name ) ) {
625
626
continue ;
626
- } else if ( ( name [ 4 ] === '-' || name === 'draggable' ) && v != null ) {
627
+ } else if (
628
+ ( name [ 4 ] === '-' || HTML_ENUMERATED . test ( name ) ) &&
629
+ v != null
630
+ ) {
627
631
// serialize boolean aria-xyz or draggable attribute values as strings
628
632
// `draggable` is an enumerated attribute and not Boolean. A value of `true` or `false` is mandatory
629
633
// https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/draggable
@@ -637,9 +641,6 @@ function _renderToString(
637
641
}
638
642
} else if ( HTML_LOWER_CASE . test ( name ) ) {
639
643
name = name . toLowerCase ( ) ;
640
- if ( name === 'spellcheck' ) {
641
- v = '' + v ;
642
- }
643
644
}
644
645
}
645
646
}
Original file line number Diff line number Diff line change 1
1
export const VOID_ELEMENTS = / ^ (?: a r e a | b a s e | b r | c o l | e m b e d | h r | i m g | i n p u t | l i n k | m e t a | p a r a m | s o u r c e | t r a c k | w b r ) $ / ;
2
2
export const UNSAFE_NAME = / [ \s \n \\ / = ' " \0 < > ] / ;
3
3
export const NAMESPACE_REPLACE_REGEX = / ^ ( x l i n k | x m l n s | x m l ) ( [ A - Z ] ) / ;
4
- export const HTML_LOWER_CASE = / ^ a c c e s s K | ^ a u t o [ A - Z ] | ^ c e l l | ^ c h | ^ c o l | c o n t | c r o s s | d a t e T | e n c T | f o r m [ A - Z ] | f r a m e | h r e f L | i n p u t M | m a x L | m i n L | n o V | p l a y s I | p o p o v e r T | r e a d O | r o w S | s p e l l C | s r c [ A - Z ] | t a b I | u s e M | i t e m [ A - Z ] / ;
5
- export const SVG_CAMEL_CASE = / ^ a c | ^ a l i | a r a b i c | b a s e l | c a p | c l i p P a t h $ | c l i p R u l e $ | c o l o r | d o m i n a n t | e n a b l e | f i l l | f l o o d | f o n t | g l y p h [ ^ R ] | h o r i z | i m a g e | l e t t e r | l i g h t i n g | m a r k e r [ ^ W U H ] | o v e r l i n e | p a n o s e | p o i n t e | p a i n t | r e n d e r i n g | s h a p e | s t o p | s t r i k e t h r o u g h | s t r o k e | s p e l | t e x t [ ^ L ] | t r a n s f o r m | u n d e r l i n e | u n i c o d e | u n i t s | ^ v [ ^ i ] | ^ w | ^ x H / ;
4
+ export const HTML_LOWER_CASE = / ^ a c c e s s K | ^ a u t o [ A - Z ] | ^ c e l l | ^ c h | ^ c o l | c o n t | c r o s s | d a t e T | e n c T | f o r m [ A - Z ] | f r a m e | h r e f L | i n p u t M | m a x L | m i n L | n o V | p l a y s I | p o p o v e r T | r e a d O | r o w S | s r c [ A - Z ] | t a b I | u s e M | i t e m [ A - Z ] / ;
5
+ export const HTML_ENUMERATED = / ^ d r a | s p e l / ;
6
+ export const SVG_CAMEL_CASE = / ^ a c | ^ a l i | a r a b i c | b a s e l | c a p | c l i p P a t h $ | c l i p R u l e $ | c o l o r | d o m i n a n t | e n a b l e | f i l l | f l o o d | f o n t | g l y p h [ ^ R ] | h o r i z | i m a g e | l e t t e r | l i g h t i n g | m a r k e r [ ^ W U H ] | o v e r l i n e | p a n o s e | p o i n t e | p a i n t | r e n d e r i n g | s h a p e | 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 ] | t r a n s f o r m | u n d e r l i n e | u n i c o d e | u n i t s | ^ v [ ^ i ] | ^ w | ^ x H / ;
6
7
7
8
// DOM properties that should NOT have "px" added when numeric
8
9
const ENCODED_ENTITIES = / [ " & < ] / ;
Original file line number Diff line number Diff line change @@ -154,11 +154,11 @@ describe('render', () => {
154
154
expect ( rendered ) . to . equal ( `<div data-checked="false"></div>` ) ;
155
155
} ) ;
156
156
157
- it ( 'should support spellCheck ' , ( ) => {
158
- let rendered = render ( < div spellCheck = { false } /> ) ;
157
+ it ( 'should support spellcheck ' , ( ) => {
158
+ let rendered = render ( < div spellcheck = { false } /> ) ;
159
159
expect ( rendered ) . to . equal ( `<div spellcheck="false"></div>` ) ;
160
160
161
- rendered = render ( < div spellCheck /> ) ;
161
+ rendered = render ( < div spellcheck /> ) ;
162
162
expect ( rendered ) . to . equal ( `<div spellcheck="true"></div>` ) ;
163
163
} ) ;
164
164
Original file line number Diff line number Diff line change @@ -400,7 +400,6 @@ export const htmlAttributes = {
400
400
slot : 'slot' ,
401
401
span : 'span' ,
402
402
spellcheck : 'spellcheck' ,
403
- spellCheck : 'spellcheck' ,
404
403
src : 'src' ,
405
404
srcset : 'srcset' ,
406
405
srcDoc : 'srcdoc' ,
You can’t perform that action at this time.
0 commit comments