mediawiki.searchSuggest: Adjust font size for all inputs, not just magic ones
authorBartosz Dziewoński <matma.rex@gmail.com>
Tue, 13 May 2014 22:31:02 +0000 (00:31 +0200)
committerKrinkle <krinklemail@gmail.com>
Fri, 16 May 2014 16:04:08 +0000 (16:04 +0000)
I have no idea why the fix was limited, this issue affects every single
input on every single page (including ones that are part of MediaWiki
interface itself, not skins, see If4ae687b).

Change-Id: I7a6dfbcced64dbfce5d1ab31201c98a134f72fe9

resources/src/mediawiki/mediawiki.searchSuggest.js

index ea7c0c5..cbdf666 100644 (file)
                        '#powerSearchText',
                        '#searchText',
                        // Generic selector for skins with multiple searchboxes (used by CologneBlue)
+                       // and for MediaWiki itself (special pages with page title inputs)
                        '.mw-searchInput'
                ];
                $( searchboxesSelectors.join( ', ' ) )
                                // make sure paste and cut events from the mouse and drag&drop events
                                // trigger the keypress handler and cause the suggestions to update
                                $( this ).trigger( 'keypress' );
+                       } )
+                       // In most skins (at least Monobook and Vector), the font-size is messed up in <body>.
+                       // (they use 2 elements to get a sane font-height). So, instead of making exceptions for
+                       // each skin or adding more stylesheets, just copy it from the active element so auto-fit.
+                       .each( function () {
+                               var $this = $( this );
+                               $this
+                                       .data( 'suggestions-context' )
+                                       .data.$container
+                                               .css( 'fontSize', $this.css( 'fontSize' ) );
                        } );
 
                // Ensure that the thing is actually present!
 
                // If the form includes any fallback fulltext search buttons, remove them
                $searchInput.closest( 'form' ).find( '.mw-fallbackSearchButton' ).remove();
-
-               // In most skins (at least Monobook and Vector), the font-size is messed up in <body>.
-               // (they use 2 elements to get a sane font-height). So, instead of making exceptions for
-               // each skin or adding more stylesheets, just copy it from the active element so auto-fit.
-               $searchInput
-                       .data( 'suggestions-context' )
-                       .data.$container
-                               .css( 'fontSize', $searchInput.css( 'fontSize' ) );
-
        } );
 
 }( mediaWiki, jQuery ) );