summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src/js/transcoder.js
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2016-09-19 17:01:39 +0200
committerqsm-odoo <qsm@odoo.com>2016-09-20 13:52:29 +0200
commit4868b045a7191d0e8b170f43275cac7130205e83 (patch)
tree5ac197e6fe6f51f9d47fdf5ef888534fbc65347f /addons/web_editor/static/src/js/transcoder.js
parenta430c81b790e2816ccbe4b3af9650101a7a4cb84 (diff)
[FIX] web_editor: remove breaking cache of transcoder
The web_editor transcoder, who is in charge to change mail css style into inline style and vice versa, has a cache to improve its efficiency. The problem is that it was designed to work only if a particular "<tag>.className" has always the same css style no matter what its parent or neighbors are. This is obviously not compatible with theme switching. Indeed, only by switching from one theme to another, the parent of every snippet have a different className which is used in css to design differently every snippet. Also inside a same theme, we obviously want to be able to style a particuler .myClass element differently from one snippet to another without having to multiple css classes. This commit removes the cache system to allow theme switching and liberty in theme designing. This however make the edition start and the saving really slower...
Diffstat (limited to 'addons/web_editor/static/src/js/transcoder.js')
-rw-r--r--addons/web_editor/static/src/js/transcoder.js6
1 files changed, 1 insertions, 5 deletions
diff --git a/addons/web_editor/static/src/js/transcoder.js b/addons/web_editor/static/src/js/transcoder.js
index fbdc4b34b87..ddd8ce73533 100644
--- a/addons/web_editor/static/src/js/transcoder.js
+++ b/addons/web_editor/static/src/js/transcoder.js
@@ -3,12 +3,8 @@ odoo.define('web_editor.transcoder', function (require) {
var widget = require('web_editor.widget');
-var cache = {};
var rulesCache = [];
var getMatchedCSSRules = function (a) {
- if(cache[a.tagName + "." +a.className]) {
- return cache[a.tagName + "." +a.className];
- }
if (!rulesCache.length) {
var sheets = document.styleSheets;
for(var i = sheets.length-1; i >= 0 ; i--) {
@@ -117,7 +113,7 @@ var getMatchedCSSRules = function (a) {
delete style['padding-left'];
}
- return a.className ? cache[a.tagName + "." +a.className] = style : style;
+ return style;
};
// convert font awsome into image