Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ssr): fix rendering of spellcheck attribute #4868

Merged
merged 1 commit into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export const expectedFailures = new Set([
'dynamic-components/index.js',
'dynamic-slots/index.js',
'empty-text-with-comments-non-static-optimized/index.js',
'global-html-attributes/index.js',
'if-conditional-slot-content/index.js',
'rehydration/index.js',
'render-dynamic-value/index.js',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,18 @@ function getChildAttrsOrProps(
.map(({ name, value, type }) => {
const key = isValidIdentifier(name) ? b.identifier(name) : b.literal(name);
if (value.type === 'Literal' && typeof value.value === 'string') {
let literalValue = value.value;
let literalValue: string | boolean = value.value;
if (name === 'style') {
literalValue = normalizeStyleAttributeValue(literalValue);
} else if (name === 'class') {
literalValue = normalizeClassAttributeValue(literalValue);
if (literalValue === '') {
return; // do not render empty `class=""`
}
} else if (name === 'spellcheck') {
// `spellcheck` string values are specially handled to massage them into booleans:
// https://github.com/salesforce/lwc/blob/574ffbd/packages/%40lwc/template-compiler/src/codegen/index.ts#L445-L448
literalValue = literalValue.toLowerCase() !== 'false';
}
return b.property('init', key, b.literal(literalValue));
} else if (value.type === 'Literal' && typeof value.value === 'boolean') {
Expand Down