Skip to content

Commit

Permalink
Merge pull request #550 from rstudio/bugfix/offscreen-shinyapps
Browse files Browse the repository at this point in the history
Deal gracefully with elements that have no computed style available
  • Loading branch information
wch committed Jul 23, 2014
2 parents 3db47c0 + 75ccfe3 commit 36aefad
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions inst/www/shared/shiny.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,14 @@
var x;
if (el.currentStyle)
x = el.currentStyle[styleProp];
else if (window.getComputedStyle)
x = document.defaultView.getComputedStyle(el, null)
.getPropertyValue(styleProp);
else if (window.getComputedStyle) {
// getComputedStyle can return null when we're inside a hidden iframe on
// Firefox; don't attempt to retrieve style props in this case.
// https://bugzilla.mozilla.org/show_bug.cgi?id=548397
var style = document.defaultView.getComputedStyle(el, null);
if (style)
x = style.getPropertyValue(styleProp);
}
return x;
}

Expand Down

0 comments on commit 36aefad

Please sign in to comment.