From 4d799b48289ac06f1e5ad77fa6dbe431597b6ab7 Mon Sep 17 00:00:00 2001 From: MatmaRex Date: Wed, 10 Jul 2013 15:10:19 +0200 Subject: [PATCH] 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 --- resources/jquery/jquery.suggestions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 ); -- 2.20.1