summaryrefslogtreecommitdiffstats
path: root/webapp
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-02-14 10:27:08 -0500
committerHarrison Healey <harrisonmhealey@gmail.com>2017-02-14 10:27:08 -0500
commita2e6553b7fa66835abce779fc25e8bef110151ca (patch)
tree57f7d399532c3d22c1d4a6279f3e6d95818c2866 /webapp
parentc6cd6feabef302587748fa6b481d58517bbec04e (diff)
downloadchat-a2e6553b7fa66835abce779fc25e8bef110151ca.tar.gz
chat-a2e6553b7fa66835abce779fc25e8bef110151ca.tar.bz2
chat-a2e6553b7fa66835abce779fc25e8bef110151ca.zip
Prevent CSS stacking when changing themes (#5378)
Diffstat (limited to 'webapp')
-rw-r--r--webapp/utils/utils.jsx11
1 files changed, 11 insertions, 0 deletions
diff --git a/webapp/utils/utils.jsx b/webapp/utils/utils.jsx
index 2fd7bf99b..40b049542 100644
--- a/webapp/utils/utils.jsx
+++ b/webapp/utils/utils.jsx
@@ -711,6 +711,17 @@ export function changeCss(className, classValue) {
// Grab style sheet
const styleSheet = styleEl.sheet;
+ const rules = styleSheet.cssRules || styleSheet.rules;
+ const style = classValue.substr(0, classValue.indexOf(':'));
+ const value = classValue.substr(classValue.indexOf(':') + 1);
+
+ for (let i = 0; i < rules.length; i++) {
+ if (rules[i].selectorText === className) {
+ rules[i].style[style] = value;
+ return;
+ }
+ }
+
let mediaQuery = '';
if (className.indexOf('@media') >= 0) {
mediaQuery = '}';