Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

window.getDefaultComputedStyle may return null #1501

Closed
wants to merge 1 commit into from

3 participants

@rosenfeld

In Iceweasel 24.2.0 it happens here when I call layout from jQuery layout plugin in an iframe from an invisible tab (from jQuery UI tabs).

I know it's not in the API specification but believe me: it may return null. Here's the message I get in the console of Iceweasel 24.2.0:

"TypeError: window.getDefaultComputedStyle(...) is null"

@rosenfeld rosenfeld window.getDefaultComputedStyle may return null
In Iceweasel 24.2.0 it happens here when I call layout from jQuery layout plugin in an iframe from an invisible tab (from jQuery UI tabs).
ab632f8
@dmethvin
Owner

I'm thinking we may not want getDefaultComputedStyle at all, we'll discuss in our meeting next week.

@rosenfeld

I agree

@dmethvin dmethvin added this to the 1.11.1/2.1.1 milestone
@dmethvin
Owner

We should either guard this for the .1 release or remove it.

@markelog
Collaborator

remove it

+1

@dmethvin
Owner

For now let's just land this patch. Longer term we should decide whether to pull this since it seems like the standards groups aren't moving on getDefaultComputedStyle and only Firefox ever implemented it.

@dmethvin dmethvin closed this pull request from a commit
@rosenfeld rosenfeld CSS: window.getDefaultComputedStyle may return null
Fixes #14736
Closes gh-1501
(cherry picked from commit 51910ba8a5aff4cd1a811f1fdb76a6c62a09a666)
e547a27
@dmethvin dmethvin closed this in e547a27
@dmethvin dmethvin referenced this pull request from a commit
@rosenfeld rosenfeld CSS: window.getDefaultComputedStyle may return null
Fixes #14736
Closes gh-1501
(cherry picked from commit 51910ba8a5aff4cd1a811f1fdb76a6c62a09a666)
5a1db91
@mescoda mescoda referenced this pull request from a commit in mescoda/jquery
@rosenfeld rosenfeld CSS: window.getDefaultComputedStyle may return null
Fixes #14736
Closes gh-1501
(cherry picked from commit 51910ba8a5aff4cd1a811f1fdb76a6c62a09a666)
c831621
@fhemberger fhemberger referenced this pull request from a commit in fhemberger/jquery
@rosenfeld rosenfeld CSS: window.getDefaultComputedStyle may return null
Fixes #14736
Closes gh-1501
(cherry picked from commit 51910ba8a5aff4cd1a811f1fdb76a6c62a09a666)
ec04c2a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 28, 2014
  1. @rosenfeld

    window.getDefaultComputedStyle may return null

    rosenfeld authored
    In Iceweasel 24.2.0 it happens here when I call layout from jQuery layout plugin in an iframe from an invisible tab (from jQuery UI tabs).
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/css/defaultDisplay.js
View
6 src/css/defaultDisplay.js
@@ -13,14 +13,14 @@ var iframe,
*/
// Called only from within defaultDisplay
function actualDisplay( name, doc ) {
- var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
+ var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), style,
// 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
Something went wrong with that request. Please try again.