aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-06-29 16:31:58 -0700
committerJose Antonio Marquez2012-06-29 16:31:58 -0700
commit435de0e8fae1e29e5203300704575ae285739191 (patch)
tree3f2b33aa7e82ba751c240e2ead1032ca4eeed031
parent4fa5952454926c069a55f6a8da277ccfa8d53c75 (diff)
parentccd9dd85d39b338c19d51e34b446b126061b07fb (diff)
downloadninja-435de0e8fae1e29e5203300704575ae285739191.tar.gz
Merge branch 'refs/heads/Ninja-Internal' into Document
-rwxr-xr-xjs/controllers/styles-controller.js22
1 files changed, 19 insertions, 3 deletions
diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js
index 478fc1db..6e363798 100755
--- a/js/controllers/styles-controller.js
+++ b/js/controllers/styles-controller.js
@@ -632,7 +632,7 @@ var stylesController = exports.StylesController = Montage.create(Component, {
632 if(!rule) { 632 if(!rule) {
633 ///// This should never be hit if providing cssText from existing rule (like those 633 ///// This should never be hit if providing cssText from existing rule (like those
634 ///// returned from getMatchedCSSRules() 634 ///// returned from getMatchedCSSRules()
635 console.warn('StylesController::_getRuleWithCSSText - No rule found with given cssText.'); 635 //console.warn('StylesController::_getRuleWithCSSText - No rule found with given cssText.');
636 } 636 }
637 637
638 return rule; 638 return rule;
@@ -646,16 +646,31 @@ var stylesController = exports.StylesController = Montage.create(Component, {
646 getMatchingRules : { //TODO: Remove omitPseudos from here and usages 646 getMatchingRules : { //TODO: Remove omitPseudos from here and usages
647 value: function(element, omitPseudos, useStageStyleSheet) { 647 value: function(element, omitPseudos, useStageStyleSheet) {
648 var rules, 648 var rules,
649 matchedRules,
649 mappedRules, 650 mappedRules,
650 doc = element.ownerDocument, 651 doc = element.ownerDocument,
651 win = doc.defaultView; 652 win = doc.defaultView;
652 653
654 if(!element.parentNode) {
655 //console.warn('StylesController::getMatchingRules - Un-attached element queried');
656 return [];
657 }
658
653 try { 659 try {
654 mappedRules = nj.toArray(win.getMatchedCSSRules(element)).map(function(rule) { 660 matchedRules = win.getMatchedCSSRules(element);
661
662 if(!matchedRules) {
663 //console.warn('StylesController::getMatchingRules - matched rules are null');
664 return [];
665 }
666
667 mappedRules = nj.toArray(matchedRules).map(function(rule) {
655 return this._getRuleWithCSSText(rule.cssText, doc); 668 return this._getRuleWithCSSText(rule.cssText, doc);
656 }, this); 669 }, this);
657 670
658 rules = mappedRules.filter(function(rule) { 671 rules = mappedRules.filter(function(rule) {
672 if(!rule) { return false; }
673
659 //// useStageStyleSheet flag indicates whether to only return rules from the stylesheet, 674 //// useStageStyleSheet flag indicates whether to only return rules from the stylesheet,
660 //// or only use rules for other stylesheets 675 //// or only use rules for other stylesheets
661 676
@@ -676,7 +691,8 @@ var stylesController = exports.StylesController = Montage.create(Component, {
676 }, this); 691 }, this);
677 692
678 } catch(ERROR) { 693 } catch(ERROR) {
679 console.warn('StylesController::getMatchingRules - Un-attached element queried.'); 694 //console.warn('StylesController::getMatchingRules - getMatchedCSSRules Exception.');
695 return [];
680 } 696 }
681 ///// Function for sorting by specificity values 697 ///// Function for sorting by specificity values
682 function sorter(ruleA, ruleB) { 698 function sorter(ruleA, ruleB) {