File tree Expand file tree Collapse file tree 4 files changed +17
-1
lines changed Expand file tree Collapse file tree 4 files changed +17
-1
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' preact-render-to-string ' : patch
3
+ ---
4
+
5
+ Fix ` spellCheck={false} ` not rendering as ` spellcheck="false" `
Original file line number Diff line number Diff line change @@ -635,6 +635,9 @@ function _renderToString(
635
635
}
636
636
} else if ( HTML_LOWER_CASE . test ( name ) ) {
637
637
name = name . toLowerCase ( ) ;
638
+ if ( name === 'spellcheck' ) {
639
+ v = '' + v ;
640
+ }
638
641
}
639
642
}
640
643
}
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ export const VOID_ELEMENTS = /^(?:area|base|br|col|embed|hr|img|input|link|meta|
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
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 | 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 / ;
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 / ;
6
6
7
7
// DOM properties that should NOT have "px" added when numeric
8
8
const ENCODED_ENTITIES = / [ " & < ] / ;
Original file line number Diff line number Diff line change @@ -154,6 +154,14 @@ 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 } /> ) ;
159
+ expect ( rendered ) . to . equal ( `<div spellcheck="false"></div>` ) ;
160
+
161
+ rendered = render ( < div spellCheck /> ) ;
162
+ expect ( rendered ) . to . equal ( `<div spellcheck="true"></div>` ) ;
163
+ } ) ;
164
+
157
165
describe ( 'attribute name sanitization' , ( ) => {
158
166
it ( 'should omit attributes with invalid names' , ( ) => {
159
167
let rendered = render (
You can’t perform that action at this time.
0 commit comments