aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRodrigo Rosenfeld Rosas <rr.rosas@gmail.com>2014-01-28 15:19:25 -0200
committerDave Methvin <dave.methvin@gmail.com>2014-03-20 14:44:25 -0400
commit5a1db91bf3e58a55bfa2baa9a3d27de3b6244ede (patch)
treec620d41bb681ebaf5bd16f63f877274d866193aa
parent17d8df8eec5a11d290d7b8cdbbb7247d2cdb7633 (diff)
downloadjquery-5a1db91bf3e58a55bfa2baa9a3d27de3b6244ede.tar.gz
jquery-5a1db91bf3e58a55bfa2baa9a3d27de3b6244ede.zip
CSS: window.getDefaultComputedStyle may return null
Fixes #14736 Closes gh-1501 (cherry picked from commit 51910ba8a5aff4cd1a811f1fdb76a6c62a09a666)
-rw-r--r--AUTHORS.txt1
-rw-r--r--src/css/defaultDisplay.js7
2 files changed, 5 insertions, 3 deletions
diff --git a/AUTHORS.txt b/AUTHORS.txt
index 9bda6ee1d..70a97e8c3 100644
--- a/AUTHORS.txt
+++ b/AUTHORS.txt
@@ -209,4 +209,5 @@ John Paul <john@johnkpaul.com>
S. Andrew Sheppard <andrew@wq.io>
Roman Reiß <me@silverwind.io>
Benjy Cui <benjytrys@gmail.com>
+Rodrigo Rosenfeld Rosas <rr.rosas@gmail.com>
diff --git a/src/css/defaultDisplay.js b/src/css/defaultDisplay.js
index 518c7d8ae..210ad4a80 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