fixup c8b6672d: restore deleted elements

This commit is contained in:
tophf 2017-11-25 23:47:25 +03:00
parent 47c6e7a52e
commit 2495ded507

View File

@ -163,7 +163,9 @@ function applyStyleState({id, enabled}) {
} else { } else {
if (inDoc) { if (inDoc) {
disabledElements.set(id, inDoc); disabledElements.set(id, inDoc);
docRootObserver.stop();
inDoc.remove(); inDoc.remove();
docRootObserver.start();
} }
} }
} }
@ -412,8 +414,8 @@ function initDocRootObserver() {
return; return;
} }
let appliedChanges = false; let appliedChanges = false;
for (const el of styleElements.values()) { for (const [idStr, el] of styleElements.entries()) {
if (!el.parentNode) { if (!el.parentNode && disabledElements.has(getStyleId(idStr))) {
continue; continue;
} }
if (el.previousElementSibling === prev) { if (el.previousElementSibling === prev) {
@ -455,7 +457,7 @@ function initDocRootObserver() {
function getStyleId(el) { function getStyleId(el) {
return parseInt(el.id.substr(ID_PREFIX.length)); return parseInt((el.id || el).substr(ID_PREFIX.length));
} }