Fix: also check elements after the last userstyle

This commit is contained in:
eight 2019-02-10 16:43:42 +08:00
parent f761aadb1a
commit 788085d376

View File

@ -38,15 +38,16 @@ function createStyleInjector({compare, setStyleContent, onUpdate}) {
if (el.parentNode !== document.documentElement) { if (el.parentNode !== document.documentElement) {
return true; return true;
} }
let i = 1; let i = 0;
while (el && i < list.length) { while (el) {
if (el.nextSibling === list[i].el) { if (i < list.length && el === list[i].el) {
i++; i++;
} else if (ORDERED_TAGS.has(el.localName)) { } else if (ORDERED_TAGS.has(el.localName)) {
break; return true;
} }
el = el.nextSibling; el = el.nextSibling;
} }
// some styles are not injected to the document
return i < list.length; return i < list.length;
} }