code clarification
This commit is contained in:
parent
1a42e6bf00
commit
91fb0579f1
|
@ -235,7 +235,7 @@
|
||||||
if (!Array.isArray(sections)) continue;
|
if (!Array.isArray(sections)) continue;
|
||||||
applySections(id, sections.map(({code}) => code).join('\n'));
|
applySections(id, sections.map(({code}) => code).join('\n'));
|
||||||
}
|
}
|
||||||
docRootObserver.start({sort: true});
|
docRootObserver.firstStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isOwnPage && !docRewriteObserver && styleElements.size) {
|
if (!isOwnPage && !docRewriteObserver && styleElements.size) {
|
||||||
|
@ -431,13 +431,16 @@
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
observer = new MutationObserver(sortStyleElements);
|
observer = new MutationObserver(sortStyleElements);
|
||||||
docRootObserver = {start, stop, evade, disconnect: stop};
|
docRootObserver = {firstStart, start, stop, evade, disconnect: stop};
|
||||||
setTimeout(sortStyleElements);
|
setTimeout(sortStyleElements);
|
||||||
}
|
}
|
||||||
function start({sort = false} = {}) {
|
function firstStart() {
|
||||||
if (sort && sortStyleMap()) {
|
if (sortStyleMap()) {
|
||||||
sortStyleElements();
|
sortStyleElements();
|
||||||
}
|
}
|
||||||
|
start();
|
||||||
|
}
|
||||||
|
function start() {
|
||||||
if (!observing && ROOT && observer) {
|
if (!observing && ROOT && observer) {
|
||||||
observer.observe(ROOT, {childList: true});
|
observer.observe(ROOT, {childList: true});
|
||||||
observing = true;
|
observing = true;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user