Add parent checking before inserting or removing the child

This commit is contained in:
Phillweston
2024-05-15 12:46:17 +00:00
parent 8c5d31498b
commit a66c416fa4
12 changed files with 34 additions and 15 deletions

View File

@@ -34,7 +34,7 @@ export function PWA(post, siteInfo) {
// 删除已有的 manifest link 元素(如果存在)
const existingManifest = document.querySelector('link[rel="manifest"]')
if (existingManifest) {
if (existingManifest && existingManifest.parentNode && existingManifest.parentNode.contains(existingManifest)) {
existingManifest.parentNode.removeChild(existingManifest)
}