diff options
Diffstat (limited to 'addons/web_editor/static/src/js/transcoder.js')
| -rw-r--r-- | addons/web_editor/static/src/js/transcoder.js | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/addons/web_editor/static/src/js/transcoder.js b/addons/web_editor/static/src/js/transcoder.js index 6e0097ee8fb..8dbc0ff0104 100644 --- a/addons/web_editor/static/src/js/transcoder.js +++ b/addons/web_editor/static/src/js/transcoder.js @@ -12,7 +12,19 @@ var getMatchedCSSRules = function (a) { if (!rulesCache.length) { var sheets = document.styleSheets; for(var i = sheets.length-1; i >= 0 ; i--) { - var rules = sheets[i].rules || sheets[i].cssRules; + var rules; + if (sheets[i].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; + } if (rules) { for(var r = rules.length-1; r >= 0; r--) { var selectorText = rules[r].selectorText; |
