TitleWidget: Use OOUI query highlighting, instead of jQuery lib
authorEd Sanders <esanders@wikimedia.org>
Sun, 1 Oct 2017 12:14:40 +0000 (13:14 +0100)
committerEd Sanders <esanders@wikimedia.org>
Sun, 1 Oct 2017 12:16:06 +0000 (13:16 +0100)
Change-Id: I75ee7b3da74bdf9638c442322b699d22b4fee74c

resources/Resources.php
resources/src/mediawiki.widgets/mw.widgets.TitleOptionWidget.js

index f9590ec..235bb59 100644 (file)
@@ -2398,8 +2398,6 @@ return [
                        'mediawiki.Title',
                        'mediawiki.api',
                        'jquery.byteLimit',
-                       // TitleOptionWidget
-                       'jquery.highlightText',
                ],
                'messages' => [
                        // NamespaceInputWidget
index 51508ab..0f1815b 100644 (file)
@@ -21,7 +21,7 @@
         * @cfg {boolean} [missing] Page doesn't exist
         * @cfg {boolean} [redirect] Page is a redirect
         * @cfg {boolean} [disambiguation] Page is a disambiguation page
-        * @cfg {string} [query] Matching query string
+        * @cfg {string} [query] Matching query string to highlight
         */
        mw.widgets.TitleOptionWidget = function MwWidgetsTitleOptionWidget( config ) {
                var icon;
                } );
 
                // Highlight matching parts of link suggestion
-               this.$label
-                       .highlightText( config.query )
-                       .attr( 'title', config.data );
+               if ( config.query ) {
+                       this.setHighlightedQuery( config.data, config.query );
+               }
+               this.$label.attr( 'title', config.data );
 
                if ( config.missing ) {
                        this.$label.addClass( 'new' );