Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed Jul 10, 2024
1 parent 8df8e8b commit 49808f8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/svelte/src/internal/client/dom/blocks/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { dev_current_component_function } from '../../runtime.js';
* @param {string} value
*/
function check_hash(element, server_hash, value) {
if (!server_hash || server_hash === hash(value)) return;
if (!server_hash || server_hash === hash(String(value ?? ''))) return;

let location;

Expand Down
2 changes: 1 addition & 1 deletion packages/svelte/src/internal/server/blocks/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import { hash } from '../../../utils.js';
* @param {string} value
*/
export function html(value) {
var open = DEV ? `<!--${hash(value)}-->` : '<!---->';
var open = DEV ? `<!--${hash(String(value ?? ''))}-->` : '<!---->';
return `${open}${value}<!---->`;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default test({
if (variant === 'dom') {
assert.ok(!span.previousSibling);
} else {
assert.ok(span.previousSibling?.textContent === ''); // ssr commment node
assert.equal(span.previousSibling?.textContent, '1tbe2lq'); // hash of the value
}

component.raw = '<span>bar</span>';
Expand Down

0 comments on commit 49808f8

Please sign in to comment.