aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Guzman2012-06-29 12:25:50 -0700
committerEric Guzman2012-06-29 12:25:50 -0700
commit06ac6fcdde5b1f9a00e4c966ce165af0a4c3c1da (patch)
treed57c032fa4d34277c7e1a6ddb226643d150687b5
parent4db51449c829f34c1875e7c5ec91343c511da729 (diff)
downloadninja-06ac6fcdde5b1f9a00e4c966ce165af0a4c3c1da.tar.gz
Null check on results from getMatchedCSSRules
-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