jquery.suggestions: Use document.documentElement.clientWidth
authorFomafix <fomafix@googlemail.com>
Wed, 5 Jun 2019 19:33:41 +0000 (21:33 +0200)
committerFomafix <fomafix@googlemail.com>
Sat, 8 Jun 2019 12:04:13 +0000 (14:04 +0200)
On skins with a border and/or a margin on the <body> or the <html>
element the width of <body> is smaller than the width of the window.

Also use .appendTo( document.body ) instead of .appendTo( $( 'body' ) ).

Bug: T47668
Change-Id: I209eb6e3b95ba0fc6e7c5084242a90ca04c9e196

resources/src/jquery/jquery.suggestions.js

index 4a1d637..964f5d0 100644 (file)
                                                } else {
                                                        // Expand from right
                                                        newCSS.left = 'auto';
-                                                       newCSS.right = $( 'body' ).width() - ( regionPosition.left + context.config.$region.outerWidth() );
+                                                       newCSS.right = document.documentElement.clientWidth -
+                                                               ( regionPosition.left + context.config.$region.outerWidth() );
                                                }
 
                                                context.data.$container.css( newCSS );
                                                                );
                                                        } )
                                        )
-                                       .appendTo( $( 'body' ) );
+                                       .appendTo( document.body );
 
                                $( this )
                                        // Stop browser autocomplete from interfering