fix: clear `<title>` correctly when navigating between pages (closes #1369) (#1428)

This commit is contained in:
Greg Johnston 2023-07-24 11:25:28 -04:00 committed by GitHub
parent 274b105676
commit 984a7388f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -125,6 +125,7 @@ pub fn Title(
match document().query_selector("title") {
Ok(Some(title)) => title.unchecked_into(),
_ => {
let el_ref = meta.title.el.clone();
let el = document().create_element("title").unwrap_throw();
let head = document().head().unwrap_throw();
head.append_child(el.unchecked_ref())
@ -134,6 +135,7 @@ pub fn Title(
let el = el.clone();
move || {
_ = head.remove_child(&el);
*el_ref.borrow_mut() = None;
}
});