File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
packages/svelte/src/internal/server Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -147,6 +147,19 @@ export function head(payload, fn) {
147
147
head_payload . out += BLOCK_CLOSE ;
148
148
}
149
149
150
+ /**
151
+ * `<div translate={false}>` should be rendered as `<div translate="no">` and _not_
152
+ * `<div translate="false">`, which is equivalent to `<div translate="yes">`. There
153
+ * may be other odd cases that need to be added to this list in future
154
+ * @type {Record<string, Map<any, string>> }
155
+ */
156
+ const replacements = {
157
+ translate : new Map ( [
158
+ [ true , 'yes' ] ,
159
+ [ false , 'no' ]
160
+ ] )
161
+ } ;
162
+
150
163
/**
151
164
* @template V
152
165
* @param {string } name
@@ -156,7 +169,8 @@ export function head(payload, fn) {
156
169
*/
157
170
export function attr ( name , value , is_boolean = false ) {
158
171
if ( value == null || ( ! value && is_boolean ) || ( value === '' && name === 'class' ) ) return '' ;
159
- const assignment = is_boolean ? '' : `="${ escape_html ( value , true ) } "` ;
172
+ const normalized = ( name in replacements && replacements [ name ] . get ( value ) ) || value ;
173
+ const assignment = is_boolean ? '' : `="${ escape_html ( normalized , true ) } "` ;
160
174
return ` ${ name } ${ assignment } ` ;
161
175
}
162
176
You can’t perform that action at this time.
0 commit comments