diff options
| author | Christophe Simonis <chs@odoo.com> | 2018-02-13 19:02:37 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2018-02-13 19:02:37 +0100 |
| commit | 19a37782fb1e40d2733604a38558bb82a6e84302 (patch) | |
| tree | 0fcbae4d10eaf9cb6006bbfb3bf9a6a350f4eb5d /addons/web_editor/static/src/js/transcoder.js | |
| parent | 5ca0ef978f350739bf2481c04ad10215d53fb362 (diff) | |
| parent | 2d73ea9bed1c6f5c801d73776e223e2be84d25f6 (diff) | |
[MERGE] forward port branch 9.0 up to 2d73ea9bed1
Diffstat (limited to 'addons/web_editor/static/src/js/transcoder.js')
| -rw-r--r-- | addons/web_editor/static/src/js/transcoder.js | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/addons/web_editor/static/src/js/transcoder.js b/addons/web_editor/static/src/js/transcoder.js index b402c14a39f..a5cf20575d4 100644 --- a/addons/web_editor/static/src/js/transcoder.js +++ b/addons/web_editor/static/src/js/transcoder.js @@ -9,17 +9,12 @@ var getMatchedCSSRules = function (a) { var sheets = document.styleSheets; for(var i = sheets.length-1; i >= 0 ; i--) { var rules; - if (sheets[i].hasOwnProperty('rules')) { - rules = sheets[i].rules; - } else { - //try...catch because Firefox not able to enumerate document.styleSheets[].cssRules[] for cross-domain stylesheets. - try { - rules = sheets[i].cssRules; - } catch(e) { - console.warn("Can't read the css rules of: " + sheets[i].href, e); - continue; - } - rules = sheets[i].cssRules; + // try...catch because browser may not able to enumerate rules for cross-domain sheets + try { + rules = sheets[i].rules || sheets[i].cssRules; + } catch (e) { + console.warn("Can't read the css rules of: " + sheets[i].href, e); + continue; } if (rules) { for(var r = rules.length-1; r >= 0; r--) { |
