From f29e3bc587e6c688d38793b2806a395da7a72457 Mon Sep 17 00:00:00 2001 From: tophf Date: Mon, 18 Dec 2017 09:54:41 +0300 Subject: [PATCH] colorpicker: remove old theme class on re-invocation --- vendor-overwrites/colorpicker/colorpicker.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vendor-overwrites/colorpicker/colorpicker.js b/vendor-overwrites/colorpicker/colorpicker.js index b5c972cc..a6f8ce6f 100644 --- a/vendor-overwrites/colorpicker/colorpicker.js +++ b/vendor-overwrites/colorpicker/colorpicker.js @@ -197,10 +197,10 @@ $formatChangeButton.title = opt.tooltipForSwitcher || ''; opt.hideDelay = Math.max(0, opt.hideDelay) || 2000; - $root.classList.add(CSS_PREFIX + 'theme-' + - (opt.theme === 'dark' || opt.theme === 'light' ? - opt.theme : - guessTheme())); + $root.className = $root.className.replace(new RegExp(CSS_PREFIX + 'theme-\\S+\\s*'), '') + + ' ' + CSS_PREFIX + 'theme-' + + (opt.theme === 'dark' || opt.theme === 'light' ? opt.theme : + guessTheme()); document.body.appendChild($root); if (!isNaN(options.left) && !isNaN(options.top)) {