aboutsummaryrefslogtreecommitdiffstats
path: root/src/offset.js
diff options
context:
space:
mode:
authorOleg <markelog@gmail.com>2012-05-28 09:49:47 +0400
committerDave Methvin <dave.methvin@gmail.com>2012-05-28 17:26:35 -0400
commit631f0933b061dc3d22ab3cd1974c5f6d02083f81 (patch)
tree6bc7e3a8b5294e9a144a4c3b5ea37b12d54f6346 /src/offset.js
parentfb21faa1bc6fb3f8676aa97cd052f3de5248b4f4 (diff)
downloadjquery-631f0933b061dc3d22ab3cd1974c5f6d02083f81.tar.gz
jquery-631f0933b061dc3d22ab3cd1974c5f6d02083f81.zip
Followup gh-796. Eliminate try-catch in oldIE, closes gh-799.
Diffstat (limited to 'src/offset.js')
-rw-r--r--src/offset.js12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/offset.js b/src/offset.js
index 728777621..362c1329b 100644
--- a/src/offset.js
+++ b/src/offset.js
@@ -11,8 +11,7 @@ jQuery.fn.offset = function( options ) {
});
}
- var docElem, body, win, clientTop, clientLeft, scrollTop, scrollLeft, top, left,
- box = {},
+ var box, docElem, body, win, clientTop, clientLeft, scrollTop, scrollLeft, top, left,
elem = this[ 0 ],
doc = elem && elem.ownerDocument;
@@ -26,15 +25,12 @@ jQuery.fn.offset = function( options ) {
docElem = doc.documentElement;
- try {
- box = elem.getBoundingClientRect();
- } catch(e) {}
-
// Make sure we're not dealing with a disconnected DOM node
- if ( !box.top || !jQuery.contains( docElem, elem ) ) {
- return { top: box.top || 0, left: box.left || 0 };
+ if ( !jQuery.contains( docElem, elem ) ) {
+ return { top: 0, left: 0 };
}
+ box = elem.getBoundingClientRect();
win = getWindow( doc );
clientTop = docElem.clientTop || body.clientTop || 0;
clientLeft = docElem.clientLeft || body.clientLeft || 0;