diff options
author | John Resig <jeresig@gmail.com> | 2009-12-09 20:58:49 -0800 |
---|---|---|
committer | John Resig <jeresig@gmail.com> | 2009-12-09 20:58:49 -0800 |
commit | cf72fba64fd164507752376a578dee7919cec911 (patch) | |
tree | 3341cb13bf782d7ac64d9fc1e36439017c7fbc81 /src/css.js | |
parent | 4e9fed3b16ed9612ed373d14a89294e98054f4dd (diff) | |
download | jquery-cf72fba64fd164507752376a578dee7919cec911.tar.gz jquery-cf72fba64fd164507752376a578dee7919cec911.zip |
Make sure that the defaultView exists before attempting to get at the computedStyle (makes it easier to hide items that don't have a view). Fixes #5619.
Diffstat (limited to 'src/css.js')
-rw-r--r-- | src/css.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/css.js b/src/css.js index 7215fe620..5b6b7b9b6 100644 --- a/src/css.js +++ b/src/css.js @@ -141,7 +141,13 @@ jQuery.extend({ name = name.replace( rupper, "-$1" ).toLowerCase(); - var computedStyle = elem.ownerDocument.defaultView.getComputedStyle( elem, null ); + var defaultView = elem.ownerDocument.defaultView; + + if ( !defaultView ) { + return null; + } + + var computedStyle = defaultView.getComputedStyle( elem, null ); if ( computedStyle ) { ret = computedStyle.getPropertyValue( name ); |