allow empty <title> tags - fixes #2980

pull/2988/head
Richard Harris 6 years ago
parent 9754f2a817
commit 6c382089d6

@ -91,7 +91,10 @@ export default class TitleWrapper extends Wrapper {
);
}
} else {
const value = stringify((this.node.children[0] as Text).data);
const value = this.node.children.length > 0
? stringify((this.node.children[0] as Text).data)
: '""';
block.builders.hydrate.add_line(`document.title = ${value};`);
}
}

@ -0,0 +1,5 @@
export default {
test({ assert, window }) {
assert.equal(window.document.title, '');
}
};

@ -0,0 +1,3 @@
<svelte:head>
<title></title>
</svelte:head>
Loading…
Cancel
Save