TheDJ has submitted this change and it was merged.

Change subject: jquery.suggestions: Use document width instead of <body> width 
for position calculation
......................................................................


jquery.suggestions: Use document width instead of <body> 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 <body> 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 <body>
a position: absolute, but that would be quite insane, so let's not
bother.

Bug: 45668
Change-Id: Ib96d1c5c3591495623933e1aa4266b0f13432610
---
M resources/jquery/jquery.suggestions.js
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  TheDJ: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/resources/jquery/jquery.suggestions.js 
b/resources/jquery/jquery.suggestions.js
index 44382f0..93fba49 100644
--- a/resources/jquery/jquery.suggestions.js
+++ b/resources/jquery/jquery.suggestions.js
@@ -220,7 +220,7 @@
                                                } 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 );

-- 
To view, visit https://gerrit.wikimedia.org/r/72937
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib96d1c5c3591495623933e1aa4266b0f13432610
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Matmarex <[email protected]>
Gerrit-Reviewer: Hoo man <[email protected]>
Gerrit-Reviewer: TheDJ <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to