fixup 2e03c9c9: the element should be in DOM before reposition()

This commit is contained in:
tophf 2017-12-02 17:17:43 +03:00
parent d263bc8e55
commit 05d1013699

View File

@ -197,6 +197,12 @@
$formatChangeButton.title = opt.tooltipForSwitcher || ''; $formatChangeButton.title = opt.tooltipForSwitcher || '';
opt.hideDelay = Math.max(0, opt.hideDelay) || 2000; opt.hideDelay = Math.max(0, opt.hideDelay) || 2000;
$root.classList.add(CSS_PREFIX + 'theme-' +
(opt.theme === 'dark' || opt.theme === 'light' ?
opt.theme :
guessTheme()));
document.body.appendChild($root);
if (!isNaN(options.left) && !isNaN(options.top)) { if (!isNaN(options.left) && !isNaN(options.top)) {
$root.style = ` $root.style = `
display: block; display: block;
@ -205,12 +211,6 @@
reposition(); reposition();
} }
$root.classList.add(CSS_PREFIX + 'theme-' +
(opt.theme === 'dark' || opt.theme === 'light' ?
opt.theme :
guessTheme()));
document.body.appendChild($root);
shown = true; shown = true;
registerEvents(); registerEvents();