Skip to content

Commit 69ca133

Browse files
committed
chore: default params for html blocks
1 parent ea4843c commit 69ca133

File tree

2 files changed

+17
-12
lines changed
  • packages/svelte/src
    • compiler/phases/3-transform/client/visitors
    • internal/client/dom/blocks

2 files changed

+17
-12
lines changed

packages/svelte/src/compiler/phases/3-transform/client/visitors/HtmlTag.js

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,22 @@ import * as b from '../../../../utils/builders.js';
1111
export function HtmlTag(node, context) {
1212
context.state.template.push('<!>');
1313

14-
// push into init, so that bindings run afterwards, which might trigger another run and override hydration
15-
context.state.init.push(
16-
b.stmt(
17-
b.call(
18-
'$.html',
19-
context.state.node,
20-
b.thunk(/** @type {Expression} */ (context.visit(node.expression))),
21-
b.literal(context.state.metadata.namespace === 'svg'),
22-
b.literal(context.state.metadata.namespace === 'mathml'),
23-
is_ignored(node, 'hydration_html_changed') && b.true
24-
)
14+
const expression = /** @type {Expression} */ (context.visit(node.expression));
15+
16+
const is_svg = context.state.metadata.namespace === 'svg';
17+
const is_mathml = context.state.metadata.namespace === 'mathml';
18+
19+
const statement = b.stmt(
20+
b.call(
21+
'$.html',
22+
context.state.node,
23+
b.thunk(expression),
24+
is_svg && b.true,
25+
is_mathml && b.true,
26+
is_ignored(node, 'hydration_html_changed') && b.true
2527
)
2628
);
29+
30+
// push into init, so that bindings run afterwards, which might trigger another run and override hydration
31+
context.state.init.push(statement);
2732
}

packages/svelte/src/internal/client/dom/blocks/html.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function check_hash(element, server_hash, value) {
3939
* @param {boolean} [skip_warning]
4040
* @returns {void}
4141
*/
42-
export function html(node, get_value, svg, mathml, skip_warning) {
42+
export function html(node, get_value, svg = false, mathml = false, skip_warning = false) {
4343
var anchor = node;
4444

4545
var value = '';

0 commit comments

Comments
 (0)