git.asbjorn.biz
/
jquery.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1844f95
)
Fix setting only one property at a time in .offset({})
author
Brandon Aaron
<brandon.aaron@gmail.com>
Tue, 23 Mar 2010 00:05:08 +0000
(20:05 -0400)
committer
Brandon Aaron
<brandon.aaron@gmail.com>
Tue, 23 Mar 2010 00:05:08 +0000
(20:05 -0400)
src/offset.js
patch
|
blob
|
history
diff --git
a/src/offset.js
b/src/offset.js
index
365b35a
..
59591ca
100644
(file)
--- a/
src/offset.js
+++ b/
src/offset.js
@@
-157,16
+157,19
@@
jQuery.offset = {
var curElem = jQuery( elem ),
curOffset = curElem.offset(),
curTop = parseInt( jQuery.curCSS( elem, "top", true ), 10 ) || 0,
var curElem = jQuery( elem ),
curOffset = curElem.offset(),
curTop = parseInt( jQuery.curCSS( elem, "top", true ), 10 ) || 0,
- curLeft = parseInt( jQuery.curCSS( elem, "left", true ), 10 ) || 0;
+ curLeft = parseInt( jQuery.curCSS( elem, "left", true ), 10 ) || 0,
+ props = {};
if ( jQuery.isFunction( options ) ) {
options = options.call( elem, i, curOffset );
}
if ( jQuery.isFunction( options ) ) {
options = options.call( elem, i, curOffset );
}
- var props = {
- top: (options.top - curOffset.top) + curTop,
- left: (options.left - curOffset.left) + curLeft
- };
+ if (options.top != null) {
+ props.top = (options.top - curOffset.top) + curTop;
+ }
+ if (options.left != null) {
+ props.left = (options.left - curOffset.left) + curLeft;
+ }
if ( "using" in options ) {
options.using.call( elem, props );
if ( "using" in options ) {
options.using.call( elem, props );