fix: hydrate `href` that is part of spread attributes (#15226)

We had some duplicated and buggy code, removing it fixes #15120
pull/15234/head
Simon H 7 months ago committed by GitHub
parent f2c83e5db7
commit 4883fd2c83
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: hydrate `href` that is part of spread attributes

@ -419,11 +419,7 @@ export function set_attributes(
// @ts-ignore
element[name] = value;
} else if (typeof value !== 'function') {
if (hydrating && (name === 'src' || name === 'href' || name === 'srcset')) {
if (!skip_warning) check_src_in_dev_hydration(element, name, value ?? '');
} else {
set_attribute(element, name, value);
}
set_attribute(element, name, value);
}
}
if (key === 'style' && '__styles' in element) {

@ -1 +1 @@
<!--[--><a href="/foo">foo</a><!--]-->
<!--[--><a href="/foo">foo</a> <a href="/foo">foo</a><!--]-->

@ -3,3 +3,4 @@
</script>
<a href={browser ? '/foo' : '/bar'}>foo</a>
<a {...{href: browser ? '/foo' : '/bar'}}>foo</a>

Loading…
Cancel
Save