From 7a762e50c70b7530830c1b8099455121fcfa0bdf Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Wed, 15 Feb 2023 11:57:01 +0100 Subject: [PATCH] Resolve #957 --- dev/Common/Html.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/dev/Common/Html.js b/dev/Common/Html.js index f5dadc991..251b2ca5b 100644 --- a/dev/Common/Html.js +++ b/dev/Common/Html.js @@ -113,12 +113,13 @@ const * Given css array, parses it and then for every selector, * prepends namespace to prevent css collision issues */ - css.applyNamespace = (namespace, prefix) => css.forEach(obj => { + css.applyNamespace = namespace => css.forEach(obj => { if (obj.type === 'media') { - obj.subStyles.applyNamespace(namespace, prefix); + obj.subStyles.applyNamespace(namespace); } else { obj.selector = obj.selector.split(',').map(selector => - namespace + ' ' + selector.replace('.', '.'+prefix) + (namespace + ' .mail-body ' + selector.replace(/\./g, '.msg-')) + .replace(/\sbody/gi, '') ).join(','); } }); @@ -146,10 +147,7 @@ const // Never have more than a single line break in a row .replace(/\n+/, "\n") // Remove :root and html - .split(/\s+/g).map(item => item - .replace(/^body$/, '.mail-body') - .replace(/^(:root|html)$/, '') - ).join(' ').trim(); + .split(/\s+/g).map(item => item.replace(/^(:root|html)$/, '')).join(' ').trim(); // determine the type if (selector.includes('@media')) { @@ -292,8 +290,8 @@ export const if ('STYLE' === name) { let css = msgId ? parseCSS(oElement.textContent) : []; if (css.length) { - css.applyNamespace(msgId, 'msg-'); - css = css.toString().replace('.msg-mail-body', '.mail-body'); + css.applyNamespace(msgId); + css = css.toString(); if (SettingsUserStore.removeColors()) { css = css.replace(/(background-)?color:[^};]+;?/g, ''); }