diff options
author | Rodrigo Rosenfeld Rosas <rr.rosas@gmail.com> | 2014-01-28 15:19:25 -0200 |
---|---|---|
committer | Dave Methvin <dave.methvin@gmail.com> | 2014-03-20 14:42:44 -0400 |
commit | e547a2775fc79e4b2eb807da9d30719afc570458 (patch) | |
tree | eeda59be462a353d2d7eb42795ab69047e5fe2ae /src | |
parent | ca0086b55a158d8a4347f94254878d6dc5dd90ed (diff) | |
download | jquery-e547a2775fc79e4b2eb807da9d30719afc570458.tar.gz jquery-e547a2775fc79e4b2eb807da9d30719afc570458.zip |
CSS: window.getDefaultComputedStyle may return null
Fixes #14736
Closes gh-1501
(cherry picked from commit 51910ba8a5aff4cd1a811f1fdb76a6c62a09a666)
Diffstat (limited to 'src')
-rw-r--r-- | src/css/defaultDisplay.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/css/defaultDisplay.js b/src/css/defaultDisplay.js index 45af9f90f..631b9ba8a 100644 --- a/src/css/defaultDisplay.js +++ b/src/css/defaultDisplay.js @@ -13,14 +13,15 @@ var iframe, */ // Called only from within defaultDisplay function actualDisplay( name, doc ) { - var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), + var style, + elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), // getDefaultComputedStyle might be reliably used only on attached element - display = window.getDefaultComputedStyle ? + display = window.getDefaultComputedStyle && ( style = window.getDefaultComputedStyle( elem[ 0 ] ) ) ? // Use of this method is a temporary fix (more like optmization) until something better comes along, // since it was removed from specification and supported only in FF - window.getDefaultComputedStyle( elem[ 0 ] ).display : jQuery.css( elem[ 0 ], "display" ); + style.display : jQuery.css( elem[ 0 ], "display" ); // We don't have any data stored on the element, // so use "detach" method as fast way to get rid of the element |