allow empty <title> tags - fixes #2980 (#2988)

pull/2992/head
Rich Harris 6 years ago committed by GitHub
parent 056b4a52de
commit 658290546a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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