aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xjs/controllers/styles-controller.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js
index aca86ec5..39deeaa8 100755
--- a/js/controllers/styles-controller.js
+++ b/js/controllers/styles-controller.js
@@ -643,6 +643,7 @@ var stylesController = exports.StylesController = Montage.create(Component, {
643 getMatchingRules : { //TODO: Remove omitPseudos from here and usages 643 getMatchingRules : { //TODO: Remove omitPseudos from here and usages
644 value: function(element, omitPseudos, useStageStyleSheet) { 644 value: function(element, omitPseudos, useStageStyleSheet) {
645 var rules, 645 var rules,
646 matchedRules,
646 mappedRules, 647 mappedRules,
647 doc = element.ownerDocument, 648 doc = element.ownerDocument,
648 win = doc.defaultView; 649 win = doc.defaultView;
@@ -653,7 +654,14 @@ var stylesController = exports.StylesController = Montage.create(Component, {
653 } 654 }
654 655
655 try { 656 try {
656 mappedRules = nj.toArray(win.getMatchedCSSRules(element)).map(function(rule) { 657 matchedRules = win.getMatchedCSSRules(element);
658
659 if(!matchedRules) {
660 console.warn('StylesController::getMatchingRules - matched rules are null');
661 return [];
662 }
663
664 mappedRules = nj.toArray(matchedRules).map(function(rule) {
657 return this._getRuleWithCSSText(rule.cssText, doc); 665 return this._getRuleWithCSSText(rule.cssText, doc);
658 }, this); 666 }, this);
659 667