Skip to content

Commit

Permalink
Position: Calculate scrollInfo just once, not for each element
Browse files Browse the repository at this point in the history
  • Loading branch information
jzaefferer committed Apr 12, 2012
1 parent 08c8aed commit 6ffc4ad
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ui/jquery.ui.position.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ $.fn.position = function( options ) {

var target = $( options.of ),
within = $( options.within || window ),
scrollInfo = $.position.getScrollInfo( within ),
targetElem = target[0],
collision = ( options.collision || "flip" ).split( " " ),
offsets = {},
Expand Down Expand Up @@ -158,7 +159,6 @@ $.fn.position = function( options ) {
elemHeight = elem.outerHeight(),
marginLeft = parseInt( $.css( this, "marginLeft" ), 10 ) || 0,
marginTop = parseInt( $.css( this, "marginTop" ), 10 ) || 0,
scrollInfo = $.position.getScrollInfo( within ),
collisionWidth = elemWidth + marginLeft +
( parseInt( $.css( this, "marginRight" ), 10 ) || 0 ) + scrollInfo.width,
collisionHeight = elemHeight + marginTop +
Expand Down

0 comments on commit 6ffc4ad

Please sign in to comment.