From: MatmaRex Date: Wed, 10 Jul 2013 13:10:19 +0000 (+0200) Subject: jquery.suggestions: Use document width instead of width for position calculation X-Git-Tag: 1.31.0-rc.0~18881^2 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=4d799b48;p=lhc%2Fweb%2Fwiklou.git jquery.suggestions: Use document width instead of width for position calculation Almost always, $( 'body' ).width() == $( document ).width(). (This is the case for all core skins, for example.) However, it is technically possible to give a width or large margins and break that assumption, so one of these should be used consistently. Document width is better here because we're using it to do absolute positioning, and usually it's relative to the viewport (ie., document width). This will still break if someone decides to give their a position: absolute, but that would be quite insane, so let's not bother. Bug: 45668 Change-Id: Ib96d1c5c3591495623933e1aa4266b0f13432610 --- diff --git a/resources/jquery/jquery.suggestions.js b/resources/jquery/jquery.suggestions.js index 44382f0d87..93fba49412 100644 --- a/resources/jquery/jquery.suggestions.js +++ b/resources/jquery/jquery.suggestions.js @@ -220,7 +220,7 @@ $.suggestions = { } else { // Expand from right newCSS.left = 'auto'; - newCSS.right = $( 'body' ).width() - ( context.config.$region.offset().left + context.config.$region.outerWidth() ); + newCSS.right = $( document ).width() - ( context.config.$region.offset().left + context.config.$region.outerWidth() ); } context.data.$container.css( newCSS );