diff options
Diffstat (limited to 'js/controllers/styles-controller.js')
-rwxr-xr-x | js/controllers/styles-controller.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js index aa5a4e7f..e78c1ef1 100755 --- a/js/controllers/styles-controller.js +++ b/js/controllers/styles-controller.js | |||
@@ -578,6 +578,10 @@ var stylesController = exports.StylesController = Montage.create(Component, { | |||
578 | rules = [], | 578 | rules = [], |
579 | win = element.ownerDocument.defaultView, | 579 | win = element.ownerDocument.defaultView, |
580 | self = this; | 580 | self = this; |
581 | |||
582 | if(!win) { | ||
583 | return null; | ||
584 | } | ||
581 | 585 | ||
582 | if(!omitPseudos) { | 586 | if(!omitPseudos) { |
583 | pseudos.concat(['link', 'visited', 'active', 'hover', 'focus', 'first-letter', | 587 | pseudos.concat(['link', 'visited', 'active', 'hover', 'focus', 'first-letter', |
@@ -681,8 +685,9 @@ var stylesController = exports.StylesController = Montage.create(Component, { | |||
681 | } | 685 | } |
682 | 686 | ||
683 | var matchingElements, i; | 687 | var matchingElements, i; |
688 | |||
684 | for(i = 0; i < specArr.length; i++) { | 689 | for(i = 0; i < specArr.length; i++) { |
685 | matchingElements = win.document.querySelectorAll(specArr[i].selector); | 690 | matchingElements = element.ownerDocument.querySelectorAll(specArr[i].selector); |
686 | if(nj.toArray(matchingElements).indexOf(element) !== -1) { | 691 | if(nj.toArray(matchingElements).indexOf(element) !== -1) { |
687 | return specArr[i]; | 692 | return specArr[i]; |
688 | } | 693 | } |