From: John Resig Date: Thu, 10 Dec 2009 04:58:49 +0000 (-0800) Subject: Make sure that the defaultView exists before attempting to get at the computedStyle... X-Git-Tag: 1.4a2~52 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=cf72fba64fd164507752376a578dee7919cec911;p=jquery.git 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. --- 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 );