Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4621fa3

Browse files
fix: wrong spellcheck attribute value
1 parentb40944a commit4621fa3

File tree

4 files changed

+17
-1
lines changed

4 files changed

+17
-1
lines changed

‎.changeset/young-avocados-float.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'preact-render-to-string':patch
3+
---
4+
5+
Fix`spellCheck={false}` not rendering as`spellcheck="false"`

‎src/index.js‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,9 @@ function _renderToString(
635635
}
636636
}elseif(HTML_LOWER_CASE.test(name)){
637637
name=name.toLowerCase();
638+
if(name==='spellcheck'){
639+
v=''+v;
640+
}
638641
}
639642
}
640643
}

‎src/lib/util.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ export const VOID_ELEMENTS = /^(?:area|base|br|col|embed|hr|img|input|link|meta|
22
exportconstUNSAFE_NAME=/[\s\n\\/='"\0<>]/;
33
exportconstNAMESPACE_REPLACE_REGEX=/^(xlink|xmlns|xml)([A-Z])/;
44
exportconstHTML_LOWER_CASE=/^accessK|^auto[A-Z]|^cell|^ch|^col|cont|cross|dateT|encT|form[A-Z]|frame|hrefL|inputM|maxL|minL|noV|playsI|popoverT|readO|rowS|spellC|src[A-Z]|tabI|useM|item[A-Z]/;
5-
exportconstSVG_CAMEL_CASE=/^ac|^ali|arabic|basel|cap|clipPath$|clipRule$|color|dominant|enable|fill|flood|font|glyph[^R]|horiz|image|letter|lighting|marker[^WUH]|overline|panose|pointe|paint|rendering|shape|stop|strikethrough|stroke|text[^L]|transform|underline|unicode|units|^v[^i]|^w|^xH/;
5+
exportconstSVG_CAMEL_CASE=/^ac|^ali|arabic|basel|cap|clipPath$|clipRule$|color|dominant|enable|fill|flood|font|glyph[^R]|horiz|image|letter|lighting|marker[^WUH]|overline|panose|pointe|paint|rendering|shape|stop|strikethrough|stroke|spel|text[^L]|transform|underline|unicode|units|^v[^i]|^w|^xH/;
66

77
// DOM properties that should NOT have "px" added when numeric
88
constENCODED_ENTITIES=/["&<]/;

‎test/render.test.jsx‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,14 @@ describe('render', () => {
154154
expect(rendered).to.equal(`<div data-checked="false"></div>`);
155155
});
156156

157+
it('should support spellCheck',()=>{
158+
letrendered=render(<divspellCheck={false}/>);
159+
expect(rendered).to.equal(`<div spellcheck="false"></div>`);
160+
161+
rendered=render(<divspellCheck/>);
162+
expect(rendered).to.equal(`<div spellcheck="true"></div>`);
163+
});
164+
157165
describe('attribute name sanitization',()=>{
158166
it('should omit attributes with invalid names',()=>{
159167
letrendered=render(

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp