aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Guzman2012-06-29 11:49:11 -0700
committerEric Guzman2012-06-29 11:49:11 -0700
commitae9a947b7019a57d399823142775c6b61ee69546 (patch)
treeaea9efe430f295d4ab5549a4c1f53e92f0137161
parent44903a3b55b4343f26de7cc4c60a2723e3131793 (diff)
downloadninja-ae9a947b7019a57d399823142775c6b61ee69546.tar.gz
Styles controller - adding check for attached element in getMatchedCSSRules
-rwxr-xr-xjs/controllers/styles-controller.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js
index 2282794c..64efdb19 100755
--- a/js/controllers/styles-controller.js
+++ b/js/controllers/styles-controller.js
@@ -629,7 +629,7 @@ var stylesController = exports.StylesController = Montage.create(Component, {
629 if(!rule) { 629 if(!rule) {
630 ///// This should never be hit if providing cssText from existing rule (like those 630 ///// This should never be hit if providing cssText from existing rule (like those
631 ///// returned from getMatchedCSSRules() 631 ///// returned from getMatchedCSSRules()
632 //console.warn('StylesController::_getRuleWithCSSText - No rule found with given cssText.'); 632 console.warn('StylesController::_getRuleWithCSSText - No rule found with given cssText.');
633 } 633 }
634 634
635 return rule; 635 return rule;
@@ -647,6 +647,10 @@ var stylesController = exports.StylesController = Montage.create(Component, {
647 doc = element.ownerDocument, 647 doc = element.ownerDocument,
648 win = doc.defaultView; 648 win = doc.defaultView;
649 649
650 if(!element.parentNode) {
651 console.warn('StylesController::getMatchingRules - Un-attached element queried');
652 }
653
650 try { 654 try {
651 mappedRules = nj.toArray(win.getMatchedCSSRules(element)).map(function(rule) { 655 mappedRules = nj.toArray(win.getMatchedCSSRules(element)).map(function(rule) {
652 return this._getRuleWithCSSText(rule.cssText, doc); 656 return this._getRuleWithCSSText(rule.cssText, doc);
@@ -675,7 +679,7 @@ var stylesController = exports.StylesController = Montage.create(Component, {
675 }, this); 679 }, this);
676 680
677 } catch(ERROR) { 681 } catch(ERROR) {
678 console.warn('StylesController::getMatchingRules - Un-attached element queried.'); 682 console.warn('StylesController::getMatchingRules - getMatchedCSSRules Exception.');
679 } 683 }
680 ///// Function for sorting by specificity values 684 ///// Function for sorting by specificity values
681 function sorter(ruleA, ruleB) { 685 function sorter(ruleA, ruleB) {