We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 056b4a5 commit 6582905Copy full SHA for 6582905
src/compiler/compile/render-dom/wrappers/Title.ts
@@ -91,7 +91,10 @@ export default class TitleWrapper extends Wrapper {
91
);
92
}
93
} else {
94
- const value = stringify((this.node.children[0] as Text).data);
+ const value = this.node.children.length > 0
95
+ ? stringify((this.node.children[0] as Text).data)
96
+ : '""';
97
+
98
block.builders.hydrate.add_line(`document.title = ${value};`);
99
100
test/runtime/samples/head-title-empty/_config.js
@@ -0,0 +1,5 @@
1
+export default {
2
+ test({ assert, window }) {
3
+ assert.equal(window.document.title, '');
4
+ }
5
+};
test/runtime/samples/head-title-empty/main.svelte
@@ -0,0 +1,3 @@
+<svelte:head>
+ <title></title>
+</svelte:head>
0 commit comments