[FIX] web_editor: inliner take in care the '!important' attributes

This commit is contained in:
Christophe Matthieu
2016-01-18 17:09:01 +01:00
parent b27d24bfe9
commit 958656d7e6
@@ -59,6 +59,9 @@ var getMatchedCSSRules = function (a) {
var style_obj = {};
for (var k=0, len=style.length; k<len; k++) {
style_obj[style[k]] = style[style[k].replace(/-(.)/g, function (a, b) { return b.toUpperCase(); })];
if (new RegExp(style[k] + '\s*:[^:;]+!important' ).test(style.cssText)) {
style_obj[style[k]] += ' !important';
}
}
rulesCache[r].style = style = style_obj;
}
@@ -87,6 +90,12 @@ var getMatchedCSSRules = function (a) {
});
});
_.each(style, function (v,k) {
if (v.indexOf('important') !== -1) {
style[k] = v.slice(0, v.length-11);
}
});
if (style.display === 'block') {
delete style.display;
}