mirror of https://github.com/sveltejs/svelte
fix: improve hydration of svelte head blocks (#11099)
* fix: improve hydration of svelte head blocks * revert sandbox * simplifypull/11093/head
parent
48549f7d00
commit
3c2f4d2d55
@ -0,0 +1,5 @@
|
||||
---
|
||||
"svelte": patch
|
||||
---
|
||||
|
||||
fix: improve hydration of svelte head blocks
|
@ -0,0 +1,9 @@
|
||||
<script>
|
||||
let title = $state('Hello world');
|
||||
let desc = $state('Some description');
|
||||
</script>
|
||||
<svelte:head>
|
||||
<title>{title}</title>
|
||||
<meta name="description" content={desc}>
|
||||
<meta name="author" content="@svelteawesome">
|
||||
</svelte:head>
|
@ -0,0 +1,12 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
html: `<div>Hello</div>`,
|
||||
|
||||
async test({ assert, target }) {
|
||||
assert.htmlEqual(
|
||||
target.ownerDocument.head.innerHTML,
|
||||
`<script async="" src="https://www.googletagmanager.com/gtag/js?id=12345"></script><meta content="Some description" name="description"><meta content="@svelteawesome" name="author"><title>Hello world</title>`
|
||||
);
|
||||
}
|
||||
});
|
@ -0,0 +1,9 @@
|
||||
<script>
|
||||
import MetaTag from './MetaTag.svelte'
|
||||
</script>
|
||||
<svelte:head>
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=12345"></script>
|
||||
</svelte:head>
|
||||
<MetaTag />
|
||||
|
||||
<div>Hello</div>
|
@ -1,6 +1,6 @@
|
||||
<!ssr:0>
|
||||
<title>Some Title</title>
|
||||
<link rel="canonical" href="/">
|
||||
<meta name="description" content="some description">
|
||||
<meta name="keywords" content="some keywords">
|
||||
<title>Some Title</title>
|
||||
<!ssr:0>
|
||||
|
Loading…
Reference in new issue