From 3c94f711434ae7fd5f983ca19c8a2c29ef22e855 Mon Sep 17 00:00:00 2001 From: Hugo Alliaume Date: Sun, 14 Jun 2020 10:36:27 +0200 Subject: [PATCH] fix($core): check if meta is from head before removing it (#2403) --- .../@vuepress/core/lib/client/root-mixins/updateMeta.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/@vuepress/core/lib/client/root-mixins/updateMeta.js b/packages/@vuepress/core/lib/client/root-mixins/updateMeta.js index eb9aebbf22..485f544d38 100644 --- a/packages/@vuepress/core/lib/client/root-mixins/updateMeta.js +++ b/packages/@vuepress/core/lib/client/root-mixins/updateMeta.js @@ -61,9 +61,9 @@ export default { */ function updateMetaTags (newMetaTags, currentMetaTags) { if (currentMetaTags) { - [...currentMetaTags].forEach(c => { - document.head.removeChild(c) - }) + [...currentMetaTags] + .filter(c => c.parentNode === document.head) + .forEach(c => document.head.removeChild(c)) } if (newMetaTags) { return newMetaTags.map(m => {