From 2495ded507bf2cc7ae174459b109f75ea96cb61e Mon Sep 17 00:00:00 2001 From: tophf Date: Sat, 25 Nov 2017 23:47:25 +0300 Subject: [PATCH] fixup c8b6672d: restore deleted elements --- content/apply.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/content/apply.js b/content/apply.js index dc3c70b3..aeb82f88 100644 --- a/content/apply.js +++ b/content/apply.js @@ -163,7 +163,9 @@ function applyStyleState({id, enabled}) { } else { if (inDoc) { disabledElements.set(id, inDoc); + docRootObserver.stop(); inDoc.remove(); + docRootObserver.start(); } } } @@ -412,8 +414,8 @@ function initDocRootObserver() { return; } let appliedChanges = false; - for (const el of styleElements.values()) { - if (!el.parentNode) { + for (const [idStr, el] of styleElements.entries()) { + if (!el.parentNode && disabledElements.has(getStyleId(idStr))) { continue; } if (el.previousElementSibling === prev) { @@ -455,7 +457,7 @@ function initDocRootObserver() { function getStyleId(el) { - return parseInt(el.id.substr(ID_PREFIX.length)); + return parseInt((el.id || el).substr(ID_PREFIX.length)); }