Skip to content
Permalink
Browse files

Fixed the case where getComputedStyled was assumed to exist if getBou…

…ndingClientRect did (which isn't the case on the Playstation 3). Fixes #5467.
  • Loading branch information
jeresig committed Nov 7, 2009
1 parent 339708c commit 9a371e2d93d6e0a70b4c99e2ca44cbe14017fe5c
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/offset.js
@@ -35,13 +35,13 @@ if ( "getBoundingClientRect" in document.documentElement ) {
var offsetParent = elem.offsetParent, prevOffsetParent = elem,
doc = elem.ownerDocument, computedStyle, docElem = doc.documentElement,
body = doc.body, defaultView = doc.defaultView,
prevComputedStyle = defaultView.getComputedStyle( elem, null ),
prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle,
top = elem.offsetTop, left = elem.offsetLeft;

while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) { break; }

computedStyle = defaultView.getComputedStyle(elem, null);
computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle;
top -= elem.scrollTop;
left -= elem.scrollLeft;

2 comments on commit 9a371e2

@jdalton

This comment has been minimized.

Copy link
Member

jdalton replied Nov 7, 2009

or IE for that matter, which supports getBoundingClientRect, but not document.defaultView

@jeresig

This comment has been minimized.

Copy link
Member Author

jeresig replied Nov 9, 2009

I mis-typed in the commit message, it's "Fixed the case where getComputedStyled was assumed to exist if getBoundingClientRect doesn't" (since, naturally, the code already worked in IE).

Please sign in to comment.
You can’t perform that action at this time.