update the style list after DOM (#998)

regressed in 7e6edb9e
This commit is contained in:
tophf 2020-07-17 22:42:21 +03:00 committed by GitHub
parent 7e6edb9e1b
commit 079b7a39f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -86,10 +86,10 @@ self.createStyleInjector = self.INJECTED === 1 ? self.createStyleInjector : ({
const el = style.el = _createStyle(style.id, style.code); const el = style.el = _createStyle(style.id, style.code);
const i = list.findIndex(item => compare(item, style) > 0); const i = list.findIndex(item => compare(item, style) > 0);
table.set(style.id, style); table.set(style.id, style);
list.splice(i < 0 ? list.length : i, 0, style);
if (isEnabled) { if (isEnabled) {
document.documentElement.insertBefore(el, i < 0 ? null : list[i].el); document.documentElement.insertBefore(el, i < 0 ? null : list[i].el);
} }
list.splice(i < 0 ? list.length : i, 0, style);
return el; return el;
} }