Rewrote .offsetParent() to work against the full jQuery set, added tests. Fixes #4922.
This commit is contained in:
parent
f0681d98fe
commit
a3b8ac413f
2 changed files with 33 additions and 6 deletions
|
@ -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;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue