diff options
author | John Resig <jeresig@gmail.com> | 2009-07-19 13:04:18 +0000 |
---|---|---|
committer | John Resig <jeresig@gmail.com> | 2009-07-19 13:04:18 +0000 |
commit | a3b8ac413f9c55994922c20b39223ab9ae6d1afa (patch) | |
tree | abdcb0b9568254b939ba95cfe50586ed78d3ced8 /src/offset.js | |
parent | f0681d98fe1fcb2995eca50a41c1c66407eab97a (diff) | |
download | jquery-a3b8ac413f9c55994922c20b39223ab9ae6d1afa.tar.gz jquery-a3b8ac413f9c55994922c20b39223ab9ae6d1afa.zip |
Rewrote .offsetParent() to work against the full jQuery set, added tests. Fixes #4922.
Diffstat (limited to 'src/offset.js')
-rw-r--r-- | src/offset.js | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/offset.js b/src/offset.js index dab0c2bfc..6e22ce30e 100644 --- a/src/offset.js +++ b/src/offset.js @@ -147,11 +147,13 @@ jQuery.fn.extend({ }, offsetParent: function() { - var offsetParent = this[0].offsetParent || document.body; - while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && jQuery.css(offsetParent, 'position') === 'static') ) { - offsetParent = offsetParent.offsetParent; - } - return jQuery( offsetParent ); + return this.map(function(){ + var offsetParent = this.offsetParent || document.body; + while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && jQuery.css(offsetParent, 'position') === 'static') ) { + offsetParent = offsetParent.offsetParent; + } + return offsetParent; + }); } }); |