Catrope has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/203477

Change subject: Stop using this.$
......................................................................

Stop using this.$

Has been a backwards-compatibility alias since OOjs UI 0.7.0.

Change-Id: I29127d3f084d7f05a4c48ba29c42a3f1827a0957
---
M demos/ve/demo.js
M lib/oojs-ui/oojs-ui.js
M src/ce/nodes/ve.ce.BlockImageNode.js
M src/ce/nodes/ve.ce.GeneratedContentNode.js
M src/ce/nodes/ve.ce.InternalListNode.js
M src/ce/nodes/ve.ce.TableNode.js
M src/ce/ve.ce.BranchNode.js
M src/ce/ve.ce.ContentBranchNode.js
M src/ce/ve.ce.Document.js
M src/ce/ve.ce.FocusableNode.js
M src/ce/ve.ce.ResizableNode.js
M src/ce/ve.ce.Surface.js
M src/ui/dialogs/ve.ui.CommandHelpDialog.js
M src/ui/dialogs/ve.ui.FindAndReplaceDialog.js
M src/ui/dialogs/ve.ui.LanguageSearchDialog.js
M src/ui/dialogs/ve.ui.ProgressDialog.js
M src/ui/dialogs/ve.ui.SpecialCharacterDialog.js
M src/ui/dialogs/ve.ui.ToolbarDialog.js
M src/ui/inspectors/ve.ui.CommentInspector.js
M src/ui/inspectors/ve.ui.FragmentInspector.js
M src/ui/inspectors/ve.ui.LanguageInspector.js
M src/ui/inspectors/ve.ui.LinkInspector.js
M src/ui/pages/ve.ui.SpecialCharacterPage.js
M src/ui/ve.ui.Context.js
M src/ui/ve.ui.DebugBar.js
M src/ui/ve.ui.DesktopContext.js
M src/ui/ve.ui.DesktopSurface.js
M src/ui/ve.ui.MobileSurface.js
M src/ui/ve.ui.Surface.js
M src/ui/ve.ui.TableContext.js
M src/ui/ve.ui.Toolbar.js
M src/ui/widgets/ve.ui.AlignWidget.js
M src/ui/widgets/ve.ui.DimensionsWidget.js
M src/ui/widgets/ve.ui.LanguageInputWidget.js
M src/ui/widgets/ve.ui.LanguageResultWidget.js
M src/ui/widgets/ve.ui.LanguageSearchWidget.js
M src/ui/widgets/ve.ui.LinkTargetInputWidget.js
M src/ui/widgets/ve.ui.MediaSizeWidget.js
M src/ui/widgets/ve.ui.SurfaceWidget.js
39 files changed, 120 insertions(+), 195 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/77/203477/1

diff --git a/demos/ve/demo.js b/demos/ve/demo.js
index b6c39b1..b5e857d 100644
--- a/demos/ve/demo.js
+++ b/demos/ve/demo.js
@@ -170,18 +170,15 @@
 
        var container = this,
                pageDropdown = new OO.ui.DropdownWidget( {
-                       $: this.$,
                        menu: {
                                items: this.getPageMenuItems()
                        }
                } ),
                pageLabel = new OO.ui.LabelWidget( {
-                       $: this.$,
                        label: 'Page',
                        input: pageDropdown
                } ),
                removeButton = new OO.ui.ButtonWidget( {
-                       $: this.$,
                        icon: 'remove',
                        label: 'Remove surface'
                } );
@@ -197,17 +194,16 @@
        this.surface = null;
        this.lang = lang;
        this.dir = dir;
-       this.$surfaceWrapper = this.$( '<div>' );
+       this.$surfaceWrapper = $( '<div>' );
        this.mode = null;
        this.pageMenu = pageDropdown.getMenu();
        this.sourceTextInput = new OO.ui.TextInputWidget( {
-               $: this.$,
                multiline: true,
                autosize: true,
                maxRows: 999,
                classes: ['ve-demo-source']
        } );
-       this.$readView = this.$( '<div>' ).addClass( 've-demo-read' ).hide();
+       this.$readView = $( '<div>' ).addClass( 've-demo-read' ).hide();
 
        // Events
        this.pageMenu.on( 'select', function ( item ) {
@@ -221,13 +217,13 @@
        removeButton.on( 'click', this.destroy.bind( this ) );
 
        this.$element.append(
-               this.$( '<div>' ).addClass( 've-demo-toolbar 
ve-demo-surfaceToolbar' ).append(
-                       this.$( '<div>' ).addClass( 've-demo-toolbar-commands' 
).append(
+               $( '<div>' ).addClass( 've-demo-toolbar ve-demo-surfaceToolbar' 
).append(
+                       $( '<div>' ).addClass( 've-demo-toolbar-commands' 
).append(
                                pageLabel.$element,
                                pageDropdown.$element,
-                               this.$( '<span 
class="ve-demo-toolbar-divider">&nbsp;</span>' ),
+                               $( '<span 
class="ve-demo-toolbar-divider">&nbsp;</span>' ),
                                this.modeSelect.$element,
-                               this.$( '<span 
class="ve-demo-toolbar-divider">&nbsp;</span>' ),
+                               $( '<span 
class="ve-demo-toolbar-divider">&nbsp;</span>' ),
                                removeButton.$element
                        )
                ),
@@ -259,7 +255,6 @@
        for ( name in ve.demo.pages ) {
                items.push(
                        new OO.ui.MenuOptionWidget( {
-                               $: this.$,
                                data: ve.demo.pages[name],
                                label: name
                        } )
@@ -362,7 +357,7 @@
                                var pageHtml;
 
                                if ( status === 'error' ) {
-                                       pageHtml = '<p><i>Failed loading page ' 
+ this.$( '<span>' ).text( src ).html() + '</i></p>';
+                                       pageHtml = '<p><i>Failed loading page ' 
+ $( '<span>' ).text( src ).html() + '</i></p>';
                                } else {
                                        pageHtml = result;
                                }
diff --git a/lib/oojs-ui/oojs-ui.js b/lib/oojs-ui/oojs-ui.js
index ccedf60..4234dfe 100644
--- a/lib/oojs-ui/oojs-ui.js
+++ b/lib/oojs-ui/oojs-ui.js
@@ -10820,7 +10820,7 @@
        OO.ui.DropdownWidget.super.call( this, config );
 
        // Properties (must be set before TabIndexedElement constructor call)
-       this.$handle = this.$( '<span>' );
+       this.$handle = $( '<span>' );
 
        // Mixin constructors
        OO.ui.IconElement.call( this, config );
@@ -12276,7 +12276,7 @@
        OO.ui.ComboBoxWidget.super.call( this, config );
 
        // Properties (must be set before TabIndexedElement constructor call)
-       this.$indicator = this.$( '<span>' );
+       this.$indicator = $( '<span>' );
 
        // Mixin constructors
        OO.ui.TabIndexedElement.call( this, $.extend( {}, config, { 
$tabIndexed: this.$indicator } ) );
diff --git a/src/ce/nodes/ve.ce.BlockImageNode.js 
b/src/ce/nodes/ve.ce.BlockImageNode.js
index 17f5732..0921204 100644
--- a/src/ce/nodes/ve.ce.BlockImageNode.js
+++ b/src/ce/nodes/ve.ce.BlockImageNode.js
@@ -25,7 +25,7 @@
        ve.ce.BlockImageNode.super.call( this, model, config );
 
        // Build DOM
-       this.$image = this.$( '<img>' )
+       this.$image = $( '<img>' )
                .prop( 'src', this.getResolvedAttribute( 'src' ) )
                .prependTo( this.$element );
 
diff --git a/src/ce/nodes/ve.ce.GeneratedContentNode.js 
b/src/ce/nodes/ve.ce.GeneratedContentNode.js
index bb5206e..8fd9719 100644
--- a/src/ce/nodes/ve.ce.GeneratedContentNode.js
+++ b/src/ce/nodes/ve.ce.GeneratedContentNode.js
@@ -126,11 +126,11 @@
                // Span wrap root text nodes so they can be measured
                for ( i = 0, len = $rendering.length; i < len; i++ ) {
                        if ( $rendering[i].nodeType === Node.TEXT_NODE ) {
-                               $rendering[i] = this.$( '<span>' ).append( 
$rendering[i] )[0];
+                               $rendering[i] = $( '<span>' ).append( 
$rendering[i] )[0];
                        }
                }
        } else {
-               $rendering = this.$( '<span>' );
+               $rendering = $( '<span>' );
        }
 
        // Render the computed values of some attributes
@@ -154,7 +154,7 @@
        if ( this.live ) {
                this.emit( 'teardown' );
        }
-       var $newElements = this.$( this.getRenderedDomElements( 
ve.copyDomElements( generatedContents ) ) );
+       var $newElements = $( this.getRenderedDomElements( ve.copyDomElements( 
generatedContents ) ) );
        if ( !this.$element[0].parentNode ) {
                // this.$element hasn't been attached yet, so just overwrite it
                this.$element = $newElements;
diff --git a/src/ce/nodes/ve.ce.InternalListNode.js 
b/src/ce/nodes/ve.ce.InternalListNode.js
index 37518c9..61cb075 100644
--- a/src/ce/nodes/ve.ce.InternalListNode.js
+++ b/src/ce/nodes/ve.ce.InternalListNode.js
@@ -18,7 +18,7 @@
        ve.ce.InternalListNode.super.apply( this, arguments );
 
        // An internal list has no rendering
-       this.$element = this.$( [] );
+       this.$element = $( [] );
 };
 
 /* Inheritance */
diff --git a/src/ce/nodes/ve.ce.TableNode.js b/src/ce/nodes/ve.ce.TableNode.js
index 779ada6..bbc193a 100644
--- a/src/ce/nodes/ve.ce.TableNode.js
+++ b/src/ce/nodes/ve.ce.TableNode.js
@@ -49,20 +49,18 @@
        this.surface = this.getRoot().getSurface();
 
        // Overlay
-       this.$selectionBox = this.$( '<div>' ).addClass( 
've-ce-tableNodeOverlay-selection-box' );
-       this.$selectionBoxAnchor = this.$( '<div>' ).addClass( 
've-ce-tableNodeOverlay-selection-box-anchor' );
+       this.$selectionBox = $( '<div>' ).addClass( 
've-ce-tableNodeOverlay-selection-box' );
+       this.$selectionBoxAnchor = $( '<div>' ).addClass( 
've-ce-tableNodeOverlay-selection-box-anchor' );
        this.colContext = new ve.ui.TableContext( this, 'table-col', {
-               $: this.$,
                classes: ['ve-ui-tableContext-colContext'],
                indicator: 'down'
        } );
        this.rowContext = new ve.ui.TableContext( this, 'table-row', {
-               $: this.$,
                classes: ['ve-ui-tableContext-rowContext'],
                indicator: 'next'
        } );
 
-       this.$overlay = this.$( '<div>' )
+       this.$overlay = $( '<div>' )
                .addClass( 've-ce-tableNodeOverlay oo-ui-element-hidden' )
                .append( [
                        this.$selectionBox,
diff --git a/src/ce/ve.ce.BranchNode.js b/src/ce/ve.ce.BranchNode.js
index d911fbc..3383920 100644
--- a/src/ce/ve.ce.BranchNode.js
+++ b/src/ce/ve.ce.BranchNode.js
@@ -181,7 +181,7 @@
        // Convert models to views and attach them to this node
        if ( args.length >= 3 ) {
                for ( i = 2, length = args.length; i < length; i++ ) {
-                       args[i] = ve.ce.nodeFactory.create( args[i].getType(), 
args[i], { $: this.$ } );
+                       args[i] = ve.ce.nodeFactory.create( args[i].getType(), 
args[i] );
                        args[i].model.connect( this, { update: 'onModelUpdate' 
} );
                }
        }
diff --git a/src/ce/ve.ce.ContentBranchNode.js 
b/src/ce/ve.ce.ContentBranchNode.js
index d984aea..19e9662 100644
--- a/src/ce/ve.ce.ContentBranchNode.js
+++ b/src/ce/ve.ce.ContentBranchNode.js
@@ -188,9 +188,7 @@
                        buffer = '';
                }
                // Create a new DOM node and descend into it
-               ann = ve.ce.annotationFactory.create(
-                       annotation.getType(), annotation, node, { $: node.$ }
-               ).$element[0];
+               ann = ve.ce.annotationFactory.create( annotation.getType(), 
annotation, node ).$element[0];
                current.appendChild( ann );
                current = ann;
        }
diff --git a/src/ce/ve.ce.Document.js b/src/ce/ve.ce.Document.js
index 96f6710..06ccfbd 100644
--- a/src/ce/ve.ce.Document.js
+++ b/src/ce/ve.ce.Document.js
@@ -16,9 +16,7 @@
  */
 ve.ce.Document = function VeCeDocument( model, surface ) {
        // Parent constructor
-       ve.Document.call( this, new ve.ce.DocumentNode(
-               model.getDocumentNode(), surface, { $: surface.$ }
-       ) );
+       ve.Document.call( this, new ve.ce.DocumentNode( 
model.getDocumentNode(), surface ) );
 
        this.getDocumentNode().$element.prop( {
                lang: model.getLang(),
diff --git a/src/ce/ve.ce.FocusableNode.js b/src/ce/ve.ce.FocusableNode.js
index 53d98c3..b4a2f67 100644
--- a/src/ce/ve.ce.FocusableNode.js
+++ b/src/ce/ve.ce.FocusableNode.js
@@ -32,7 +32,7 @@
        this.focused = false;
        this.highlighted = false;
        this.isFocusableSetup = false;
-       this.$highlights = this.$( '<div>' ).addClass( 
've-ce-focusableNode-highlights' );
+       this.$highlights = $( '<div>' ).addClass( 
've-ce-focusableNode-highlights' );
        this.$focusable = $focusable || this.$element;
        this.focusableSurface = null;
        this.rects = null;
@@ -80,13 +80,13 @@
  * @returns {jQuery} A highlight element
  */
 ve.ce.FocusableNode.prototype.createHighlight = function () {
-       return this.$( '<div>' )
+       return $( '<div>' )
                .addClass( 've-ce-focusableNode-highlight' )
                .prop( {
                        title: this.constructor.static.getDescription( 
this.model ),
                        draggable: false
                } )
-               .append( this.$( '<img>' )
+               .append( $( '<img>' )
                        .addClass( 
've-ce-focusableNode-highlight-relocatable-marker' )
                        .attr( 'src', 
'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==' )
                        .on( {
@@ -265,7 +265,7 @@
  * @param {jQuery.Event} e Mouse move event
  */
 ve.ce.FocusableNode.prototype.onSurfaceMouseMove = function ( e ) {
-       var $target = this.$( e.target );
+       var $target = $( e.target );
        if (
                !$target.hasClass( 've-ce-focusableNode-highlight' ) &&
                $target.closest( '.ve-ce-focusableNode' ).length === 0
diff --git a/src/ce/ve.ce.ResizableNode.js b/src/ce/ve.ce.ResizableNode.js
index 2d6ea72..b6f68e7 100644
--- a/src/ce/ve.ce.ResizableNode.js
+++ b/src/ce/ve.ce.ResizableNode.js
@@ -24,7 +24,7 @@
        // Properties
        this.$resizable = $resizable || this.$element;
        this.resizing = false;
-       this.$resizeHandles = this.$( '<div>' );
+       this.$resizeHandles = $( '<div>' );
        this.snapToGrid = config.snapToGrid !== undefined ? config.snapToGrid : 
10;
        this.outline = !!config.outline;
        this.showSizeLabel = config.showSizeLabel !== false;
@@ -32,8 +32,8 @@
        // Only gets enabled when the original dimensions are provided
        this.canShowScaleLabel = false;
        if ( this.showSizeLabel || this.showScaleLabel ) {
-               this.$sizeText = this.$( '<span>' ).addClass( 
've-ce-resizableNode-sizeText' );
-               this.$sizeLabel = this.$( '<div>' ).addClass( 
've-ce-resizableNode-sizeLabel' ).append( this.$sizeText );
+               this.$sizeText = $( '<span>' ).addClass( 
've-ce-resizableNode-sizeText' );
+               this.$sizeLabel = $( '<div>' ).addClass( 
've-ce-resizableNode-sizeLabel' ).append( this.$sizeText );
        }
        this.resizableOffset = null;
        this.resizableSurface = null;
@@ -56,16 +56,16 @@
        // Initialization
        this.$resizeHandles
                .addClass( 've-ce-resizableNode-handles' )
-               .append( this.$( '<div>' )
+               .append( $( '<div>' )
                        .addClass( 've-ce-resizableNode-nwHandle' )
                        .data( 'handle', 'nw' ) )
-               .append( this.$( '<div>' )
+               .append( $( '<div>' )
                        .addClass( 've-ce-resizableNode-neHandle' )
                        .data( 'handle', 'ne' ) )
-               .append( this.$( '<div>' )
+               .append( $( '<div>' )
                        .addClass( 've-ce-resizableNode-seHandle' )
                        .data( 'handle', 'se' ) )
-               .append( this.$( '<div>' )
+               .append( $( '<div>' )
                        .addClass( 've-ce-resizableNode-swHandle' )
                        .data( 'handle', 'sw' ) );
 };
@@ -167,13 +167,13 @@
                } );
        this.$sizeText.empty();
        if ( this.showSizeLabel ) {
-               this.$sizeText.append( this.$( '<span>' )
+               this.$sizeText.append( $( '<span>' )
                        .addClass( 've-ce-resizableNode-sizeText-size' )
                        .text( Math.round( dimensions.width ) + ' × ' + 
Math.round( dimensions.height ) )
                );
        }
        if ( this.canShowScaleLabel ) {
-               this.$sizeText.append( this.$( '<span>' )
+               this.$sizeText.append( $( '<span>' )
                        .addClass( 've-ce-resizableNode-sizeText-scale' )
                        .text( Math.round( 100 * scalable.getCurrentScale() ) + 
'%' )
                );
@@ -392,7 +392,7 @@
                height: this.resizeInfo.height
        } );
        this.updateSizeLabel();
-       this.$( this.getElementDocument() ).on( {
+       $( this.getElementDocument() ).on( {
                'mousemove.ve-ce-resizableNode': this.onDocumentMouseMove.bind( 
this ),
                'mouseup.ve-ce-resizableNode': this.onDocumentMouseUp.bind( 
this )
        } );
@@ -532,7 +532,7 @@
                selection = surfaceModel.getSelection();
 
        this.$resizeHandles.removeClass( 've-ce-resizableNode-handles-resizing' 
);
-       this.$( this.getElementDocument() ).off( '.ve-ce-resizableNode' );
+       $( this.getElementDocument() ).off( '.ve-ce-resizableNode' );
        this.resizing = false;
        this.root.getSurface().resizing = false;
        this.hideSizeLabel();
diff --git a/src/ce/ve.ce.Surface.js b/src/ce/ve.ce.Surface.js
index c08c8a0..d73518a 100644
--- a/src/ce/ve.ce.Surface.js
+++ b/src/ce/ve.ce.Surface.js
@@ -32,8 +32,8 @@
        this.documentView = new ve.ce.Document( model.getDocument(), this );
        this.surfaceObserver = new ve.ce.SurfaceObserver( this );
        this.selectionTimeout = null;
-       this.$window = this.$( this.getElementWindow() );
-       this.$document = this.$( this.getElementDocument() );
+       this.$window = $( this.getElementWindow() );
+       this.$document = $( this.getElementDocument() );
        this.$documentNode = this.getDocument().getDocumentNode().$element;
        // Window.getSelection returns a live singleton representing the 
document's selection
        this.nativeSelection = this.getElementWindow().getSelection();
@@ -51,19 +51,19 @@
        this.resizing = false;
        this.focused = false;
        this.deactivated = false;
-       this.$deactivatedSelection = this.$( '<div>' );
+       this.$deactivatedSelection = $( '<div>' );
        this.activeTableNode = null;
        this.contentBranchNodeChanged = false;
-       this.$highlightsFocused = this.$( '<div>' );
-       this.$highlightsBlurred = this.$( '<div>' );
-       this.$highlights = this.$( '<div>' ).append(
+       this.$highlightsFocused = $( '<div>' );
+       this.$highlightsBlurred = $( '<div>' );
+       this.$highlights = $( '<div>' ).append(
                this.$highlightsFocused, this.$highlightsBlurred
        );
-       this.$findResults = this.$( '<div>' );
-       this.$dropMarker = this.$( '<div>' ).addClass( 
've-ce-surface-dropMarker oo-ui-element-hidden' );
+       this.$findResults = $( '<div>' );
+       this.$dropMarker = $( '<div>' ).addClass( 've-ce-surface-dropMarker 
oo-ui-element-hidden' );
        this.$lastDropTarget = null;
        this.lastDropPosition = null;
-       this.$pasteTarget = this.$( '<div>' );
+       this.$pasteTarget = $( '<div>' );
        this.pasting = false;
        this.copying = false;
        this.pasteSpecial = false;
@@ -334,7 +334,7 @@
                        textRange = document.body.createTextRange();
                        textRange.moveToPoint( x, y );
                        textRange.pasteHTML( '<span 
class="ve-ce-textRange-drop-marker">&nbsp;</span>' );
-                       $marker = this.$( '.ve-ce-textRange-drop-marker' );
+                       $marker = $( '.ve-ce-textRange-drop-marker' );
                        offset = ve.ce.getOffset( $marker.get( 0 ), 0 );
                        $marker.remove();
                }
@@ -712,7 +712,7 @@
        rects = this.getSelectionRects( selection );
        if ( rects ) {
                for ( i = 0, l = rects.length; i < l; i++ ) {
-                       this.$deactivatedSelection.append( this.$( '<div>' 
).css( {
+                       this.$deactivatedSelection.append( $( '<div>' ).css( {
                                top: rects[i].top,
                                left: rects[i].left,
                                width: rects[i].width,
@@ -1624,7 +1624,7 @@
        } else {
                clipboardItem.hash = this.constructor.static.getClipboardHash( 
this.$pasteTarget.contents() );
                this.$pasteTarget.prepend(
-                       this.$( '<span>' ).attr( 'data-ve-clipboard-key', 
this.clipboardId + '-' + clipboardIndex ).html( '&nbsp;' )
+                       $( '<span>' ).attr( 'data-ve-clipboard-key', 
this.clipboardId + '-' + clipboardIndex ).html( '&nbsp;' )
                );
 
                // If direct clipboard editing is not allowed, we must use the 
pasteTarget to
@@ -1873,7 +1873,7 @@
                clipboardKey = beforePasteData.custom;
        } else {
                if ( beforePasteData.html ) {
-                       $elements = this.$( $.parseHTML( beforePasteData.html ) 
);
+                       $elements = $( $.parseHTML( beforePasteData.html ) );
 
                        // Try to find the clipboard key hidden in the HTML
                        $elements = $elements.filter( function () {
@@ -1965,7 +1965,7 @@
                        // If the clipboardKey is set (paste from other VE 
instance), and clipboard
                        // data is available, then make sure important spans 
haven't been dropped
                        if ( !$elements ) {
-                               $elements = this.$( $.parseHTML( 
beforePasteData.html ) );
+                               $elements = $( $.parseHTML( 
beforePasteData.html ) );
                        }
                        if (
                                // HACK: Allow the test runner to force the use 
of clipboardData
@@ -2848,7 +2848,7 @@
        if ( cursorNode.nodeType === Node.TEXT_NODE ) {
                cursorNode = cursorNode.parentNode;
        }
-       return this.$( cursorNode ).css( 'direction' );
+       return $( cursorNode ).css( 'direction' );
 };
 
 /**
diff --git a/src/ui/dialogs/ve.ui.CommandHelpDialog.js 
b/src/ui/dialogs/ve.ui.CommandHelpDialog.js
index d1bc47e..0f5dde2 100644
--- a/src/ui/dialogs/ve.ui.CommandHelpDialog.js
+++ b/src/ui/dialogs/ve.ui.CommandHelpDialog.js
@@ -61,16 +61,15 @@
                commandGroups = this.constructor.static.getCommandGroups();
 
        this.contentLayout = new OO.ui.PanelLayout( {
-               $: this.$,
                scrollable: true,
                padded: true,
                expanded: false
        } );
-       this.$container = this.$( '<div>' ).addClass( 
've-ui-commandHelpDialog-container' );
+       this.$container = $( '<div>' ).addClass( 
've-ui-commandHelpDialog-container' );
 
        for ( i in commandGroups ) {
                commands = commandGroups[i].commands;
-               $list = this.$( '<dl>' ).addClass( 
've-ui-commandHelpDialog-list' );
+               $list = $( '<dl>' ).addClass( 've-ui-commandHelpDialog-list' );
                for ( j = 0, jLen = commands.length; j < jLen; j++ ) {
                        if ( commands[j].trigger ) {
                                triggerList = ve.ui.triggerRegistry.lookup( 
commands[j].trigger );
@@ -86,22 +85,22 @@
                                        );
                                }
                        }
-                       $shortcut = this.$( '<dt>' );
+                       $shortcut = $( '<dt>' );
                        for ( k = 0, kLen = triggerList.length; k < kLen; k++ ) 
{
-                               $shortcut.append( this.$( '<kbd>' ).text(
+                               $shortcut.append( $( '<kbd>' ).text(
                                        triggerList[k].getMessage().replace( 
/\+/g, ' + ' )
                                ) );
                        }
                        $list.append(
                                $shortcut,
-                               this.$( '<dd>' ).text( ve.msg( commands[j].msg 
) )
+                               $( '<dd>' ).text( ve.msg( commands[j].msg ) )
                        );
                }
                this.$container.append(
-                       this.$( '<div>' )
+                       $( '<div>' )
                                .addClass( 've-ui-commandHelpDialog-section' )
                                .append(
-                                       this.$( '<h3>' ).text( ve.msg( 
commandGroups[i].title ) ),
+                                       $( '<h3>' ).text( ve.msg( 
commandGroups[i].title ) ),
                                        $list
                                )
                );
diff --git a/src/ui/dialogs/ve.ui.FindAndReplaceDialog.js 
b/src/ui/dialogs/ve.ui.FindAndReplaceDialog.js
index 1cc6735..218ee0e 100644
--- a/src/ui/dialogs/ve.ui.FindAndReplaceDialog.js
+++ b/src/ui/dialogs/ve.ui.FindAndReplaceDialog.js
@@ -49,7 +49,7 @@
        // Parent method
        ve.ui.FindAndReplaceDialog.super.prototype.initialize.call( this );
 
-       this.$findResults = this.$( '<div>' ).addClass( 
've-ui-findAndReplaceDialog-findResults' );
+       this.$findResults = $( '<div>' ).addClass( 
've-ui-findAndReplaceDialog-findResults' );
        this.fragments = [];
        this.results = 0;
        // Range over the list of fragments indicating which ones where 
rendered,
@@ -59,47 +59,38 @@
        this.focusedIndex = 0;
        this.query = null;
        this.findText = new OO.ui.TextInputWidget( {
-               $: this.$,
                placeholder: ve.msg( 'visualeditor-find-and-replace-find-text' )
        } );
        this.matchCaseToggle = new OO.ui.ToggleButtonWidget( {
-               $: this.$,
                icon: 'case-sensitive',
                iconTitle: ve.msg( 'visualeditor-find-and-replace-match-case' )
        } );
        this.regexToggle = new OO.ui.ToggleButtonWidget( {
-               $: this.$,
                icon: 'regular-expression',
                iconTitle: ve.msg( 
'visualeditor-find-and-replace-regular-expression' )
        } );
 
        this.previousButton = new OO.ui.ButtonWidget( {
-               $: this.$,
                icon: 'previous',
                iconTitle: ve.msg( 
'visualeditor-find-and-replace-previous-button' ) + ' ' +
                        ve.ui.triggerRegistry.getMessages( 'findPrevious' 
).join( ', ' )
        } );
        this.nextButton = new OO.ui.ButtonWidget( {
-               $: this.$,
                icon: 'next',
                iconTitle: ve.msg( 'visualeditor-find-and-replace-next-button' 
) + ' ' +
                        ve.ui.triggerRegistry.getMessages( 'findNext' ).join( 
', ' )
        } );
        this.replaceText = new OO.ui.TextInputWidget( {
-               $: this.$,
                placeholder: ve.msg( 
'visualeditor-find-and-replace-replace-text' )
        } );
        this.replaceButton = new OO.ui.ButtonWidget( {
-               $: this.$,
                label: ve.msg( 'visualeditor-find-and-replace-replace-button' )
        } );
        this.replaceAllButton = new OO.ui.ButtonWidget( {
-               $: this.$,
                label: ve.msg( 
'visualeditor-find-and-replace-replace-all-button' )
        } );
 
        var optionsGroup = new OO.ui.ButtonGroupWidget( {
-                       $: this.$,
                        classes: ['ve-ui-findAndReplaceDialog-cell'],
                        items: [
                                this.matchCaseToggle,
@@ -107,7 +98,6 @@
                        ]
                } ),
                navigateGroup = new OO.ui.ButtonGroupWidget( {
-                       $: this.$,
                        classes: ['ve-ui-findAndReplaceDialog-cell'],
                        items: [
                                this.previousButton,
@@ -115,7 +105,6 @@
                        ]
                } ),
                replaceGroup = new OO.ui.ButtonGroupWidget( {
-                       $: this.$,
                        classes: ['ve-ui-findAndReplaceDialog-cell'],
                        items: [
                                this.replaceButton,
@@ -123,12 +112,11 @@
                        ]
                } ),
                doneButton = new OO.ui.ButtonWidget( {
-                       $: this.$,
                        classes: ['ve-ui-findAndReplaceDialog-cell'],
                        label: ve.msg( 'visualeditor-find-and-replace-done' )
                } ),
-               $findRow = this.$( '<div>' ).addClass( 
've-ui-findAndReplaceDialog-row' ),
-               $replaceRow = this.$( '<div>' ).addClass( 
've-ui-findAndReplaceDialog-row' );
+               $findRow = $( '<div>' ).addClass( 
've-ui-findAndReplaceDialog-row' ),
+               $replaceRow = $( '<div>' ).addClass( 
've-ui-findAndReplaceDialog-row' );
 
        // Events
        this.onWindowScrollDebounced = ve.debounce( this.onWindowScroll.bind( 
this ), 250 );
@@ -153,14 +141,14 @@
        this.$body
                .append(
                        $findRow.append(
-                               this.$( '<div>' ).addClass( 
've-ui-findAndReplaceDialog-cell ve-ui-findAndReplaceDialog-cell-input' 
).append(
+                               $( '<div>' ).addClass( 
've-ui-findAndReplaceDialog-cell ve-ui-findAndReplaceDialog-cell-input' 
).append(
                                        this.findText.$element
                                ),
                                navigateGroup.$element,
                                optionsGroup.$element
                        ),
                        $replaceRow.append(
-                               this.$( '<div>' ).addClass( 
've-ui-findAndReplaceDialog-cell ve-ui-findAndReplaceDialog-cell-input' 
).append(
+                               $( '<div>' ).addClass( 
've-ui-findAndReplaceDialog-cell ve-ui-findAndReplaceDialog-cell-input' 
).append(
                                        this.replaceText.$element
                                ),
                                replaceGroup.$element,
@@ -344,11 +332,11 @@
        this.$findResults.empty();
        for ( i = range.start; i < range.end; i++ ) {
                rects = this.surface.getView().getSelectionRects( 
this.fragments[i].getSelection() );
-               $result = this.$( '<div>' ).addClass( 
've-ui-findAndReplaceDialog-findResult' );
+               $result = $( '<div>' ).addClass( 
've-ui-findAndReplaceDialog-findResult' );
                top = Infinity;
                for ( j = 0, jlen = rects.length; j < jlen; j++ ) {
                        top = Math.min( top, rects[j].top );
-                       $result.append( this.$( '<div>' ).css( {
+                       $result.append( $( '<div>' ).css( {
                                top: rects[j].top,
                                left: rects[j].left,
                                width: rects[j].width,
@@ -406,7 +394,7 @@
                windowScrollHeight = surfaceView.$window.height() - 
this.surface.toolbarHeight;
 
                if ( offset < windowScrollTop || offset > windowScrollTop + 
windowScrollHeight ) {
-                       surfaceView.$( 'body, html' ).animate( { scrollTop: 
offset - ( windowScrollHeight / 2  ) }, 'fast' );
+                       $( 'body, html' ).animate( { scrollTop: offset - ( 
windowScrollHeight / 2  ) }, 'fast' );
                }
        }
 };
diff --git a/src/ui/dialogs/ve.ui.LanguageSearchDialog.js 
b/src/ui/dialogs/ve.ui.LanguageSearchDialog.js
index 7b33ce6..c97ef2d 100644
--- a/src/ui/dialogs/ve.ui.LanguageSearchDialog.js
+++ b/src/ui/dialogs/ve.ui.LanguageSearchDialog.js
@@ -54,9 +54,7 @@
 ve.ui.LanguageSearchDialog.prototype.initialize = function () {
        ve.ui.LanguageSearchDialog.super.prototype.initialize.apply( this, 
arguments );
 
-       this.searchWidget = new this.constructor.static.languageSearchWidget( {
-               $: this.$
-       } );
+       this.searchWidget = new this.constructor.static.languageSearchWidget();
        this.searchWidget.getResults().connect( this, { choose: 
'onSearchResultsChoose' } );
        this.$body.append( this.searchWidget.$element );
 };
diff --git a/src/ui/dialogs/ve.ui.ProgressDialog.js 
b/src/ui/dialogs/ve.ui.ProgressDialog.js
index da85100..06dcd96 100644
--- a/src/ui/dialogs/ve.ui.ProgressDialog.js
+++ b/src/ui/dialogs/ve.ui.ProgressDialog.js
@@ -68,18 +68,16 @@
 
                        for ( i = 0, l = progresses.length; i < l; i++ ) {
                                cancelDeferred = $.Deferred();
-                               $row = this.$( '<div>' ).addClass( 
've-ui-progressDialog-row' );
-                               progressBar = new OO.ui.ProgressBarWidget( { $: 
this.$ } );
+                               $row = $( '<div>' ).addClass( 
've-ui-progressDialog-row' );
+                               progressBar = new OO.ui.ProgressBarWidget();
                                fieldLayout = new OO.ui.FieldLayout(
                                        progressBar,
                                        {
-                                               $: this.$,
                                                label: progresses[i].label,
                                                align: 'top'
                                        }
                                );
                                cancelButton = new OO.ui.ButtonWidget( {
-                                       $: this.$,
                                        framed: false,
                                        icon: 'clear',
                                        iconTitle: OO.ui.deferMsg( 
'visualeditor-dialog-action-cancel' )
diff --git a/src/ui/dialogs/ve.ui.SpecialCharacterDialog.js 
b/src/ui/dialogs/ve.ui.SpecialCharacterDialog.js
index 594555c..3f84c79 100644
--- a/src/ui/dialogs/ve.ui.SpecialCharacterDialog.js
+++ b/src/ui/dialogs/ve.ui.SpecialCharacterDialog.js
@@ -48,7 +48,7 @@
        // Parent method
        ve.ui.SpecialCharacterDialog.super.prototype.initialize.call( this );
 
-       this.$spinner = this.$( '<div>' ).addClass( 
've-ui-specialCharacterDialog-spinner' );
+       this.$spinner = $( '<div>' ).addClass( 
've-ui-specialCharacterDialog-spinner' );
        this.$content.append( this.$spinner );
 };
 
@@ -127,7 +127,6 @@
                isInsideDialog = !!this.manager.$element.closest( 
'.oo-ui-dialog' ).length;
 
        this.bookletLayout = new OO.ui.BookletLayout( {
-               $: this.$,
                outlined: true,
                menuSize: isInsideDialog ? '10em' : '18em',
                continuous: true
@@ -136,7 +135,6 @@
        for ( category in this.characters ) {
                this.pages.push(
                        new ve.ui.SpecialCharacterPage( category, {
-                               $: this.$,
                                label: category,
                                characters: this.characters[category]
                        } )
diff --git a/src/ui/dialogs/ve.ui.ToolbarDialog.js 
b/src/ui/dialogs/ve.ui.ToolbarDialog.js
index 4f01752..5222d73 100644
--- a/src/ui/dialogs/ve.ui.ToolbarDialog.js
+++ b/src/ui/dialogs/ve.ui.ToolbarDialog.js
@@ -21,7 +21,7 @@
 
        // Properties
        this.disabled = false;
-       this.$shield = this.$( '<div>' ).addClass( 've-ui-toolbarDialog-shield' 
);
+       this.$shield = $( '<div>' ).addClass( 've-ui-toolbarDialog-shield' );
 
        // Pre-initialization
        // This class needs to exist before setup to constrain the height
diff --git a/src/ui/inspectors/ve.ui.CommentInspector.js 
b/src/ui/inspectors/ve.ui.CommentInspector.js
index d299bcc..bd60878 100644
--- a/src/ui/inspectors/ve.ui.CommentInspector.js
+++ b/src/ui/inspectors/ve.ui.CommentInspector.js
@@ -54,7 +54,6 @@
        ve.ui.CommentInspector.super.prototype.initialize.call( this );
 
        this.textWidget = new ve.ui.WhitespacePreservingTextInputWidget( {
-               $: this.$,
                multiline: true,
                autosize: true
        } );
diff --git a/src/ui/inspectors/ve.ui.FragmentInspector.js 
b/src/ui/inspectors/ve.ui.FragmentInspector.js
index 210c0e6..fda7668 100644
--- a/src/ui/inspectors/ve.ui.FragmentInspector.js
+++ b/src/ui/inspectors/ve.ui.FragmentInspector.js
@@ -90,10 +90,10 @@
 
        // Properties
        this.container = new OO.ui.PanelLayout( {
-               $: this.$, scrollable: true, classes: [ 
've-ui-fragmentInspector-container' ]
+               scrollable: true, classes: [ 
've-ui-fragmentInspector-container' ]
        } );
        this.form = new OO.ui.FormLayout( {
-               $: this.$, classes: [ 've-ui-fragmentInspector-form' ]
+               classes: [ 've-ui-fragmentInspector-form' ]
        } );
 
        // Events
diff --git a/src/ui/inspectors/ve.ui.LanguageInspector.js 
b/src/ui/inspectors/ve.ui.LanguageInspector.js
index b72142a..2c18244 100644
--- a/src/ui/inspectors/ve.ui.LanguageInspector.js
+++ b/src/ui/inspectors/ve.ui.LanguageInspector.js
@@ -73,7 +73,6 @@
 
        // Properties
        this.languageInput = new ve.ui.LanguageInputWidget( {
-               $: this.$,
                dialogManager: this.manager.getSurface().getDialogs()
        } );
 
diff --git a/src/ui/inspectors/ve.ui.LinkInspector.js 
b/src/ui/inspectors/ve.ui.LinkInspector.js
index 576908e..4bbb0c1 100644
--- a/src/ui/inspectors/ve.ui.LinkInspector.js
+++ b/src/ui/inspectors/ve.ui.LinkInspector.js
@@ -105,7 +105,6 @@
 
        // Properties
        this.targetInput = new this.constructor.static.linkTargetInputWidget( {
-               $: this.$,
                $overlay: overlay ? overlay.$element : this.$frame,
                disabled: true,
                classes: [ 've-ui-linkInspector-target' ]
diff --git a/src/ui/pages/ve.ui.SpecialCharacterPage.js 
b/src/ui/pages/ve.ui.SpecialCharacterPage.js
index 366f591..ba5ec82 100644
--- a/src/ui/pages/ve.ui.SpecialCharacterPage.js
+++ b/src/ui/pages/ve.ui.SpecialCharacterPage.js
@@ -24,11 +24,11 @@
 
        var character,
                characters = config.characters,
-               $characters = this.$( '<div>' ).addClass( 
've-ui-specialCharacterPage-characters' );
+               $characters = $( '<div>' ).addClass( 
've-ui-specialCharacterPage-characters' );
 
        for ( character in characters ) {
                $characters.append(
-                       this.$( '<div>' )
+                       $( '<div>' )
                                .addClass( 
've-ui-specialCharacterPage-character' )
                                .data( 'character', characters[character] )
                                .text( character )
@@ -37,7 +37,7 @@
 
        this.$element
                .addClass( 've-ui-specialCharacterPage')
-               .append( this.$( '<h3>' ).text( name ), $characters );
+               .append( $( '<h3>' ).text( name ), $characters );
 };
 
 /* Inheritance */
diff --git a/src/ui/ve.ui.Context.js b/src/ui/ve.ui.Context.js
index a13a7a7..89b356a 100644
--- a/src/ui/ve.ui.Context.js
+++ b/src/ui/ve.ui.Context.js
@@ -365,11 +365,11 @@
                source = sources[i];
                if ( source.type === 'item' ) {
                        items.push( ve.ui.contextItemFactory.create(
-                               sources[i].name, this, sources[i].model, { $: 
this.$ }
+                               sources[i].name, this, sources[i].model
                        ) );
                } else if ( source.type === 'tool' ) {
                        items.push( new ve.ui.ToolContextItem(
-                               this, sources[i].model, 
ve.ui.toolFactory.lookup( sources[i].name ), { $: this.$ }
+                               this, sources[i].model, 
ve.ui.toolFactory.lookup( sources[i].name )
                        ) );
                }
        }
diff --git a/src/ui/ve.ui.DebugBar.js b/src/ui/ve.ui.DebugBar.js
index a9cf475..16470a7 100644
--- a/src/ui/ve.ui.DebugBar.js
+++ b/src/ui/ve.ui.DebugBar.js
@@ -22,31 +22,30 @@
 
        this.surface = surface;
 
-       this.$commands = this.$( '<div>' ).addClass( 've-ui-debugBar-commands' 
);
-       this.$dumpLinmodData = this.$( '<td>' ).addClass( 
've-ui-debugBar-dump-linmod-data' );
-       this.$dumpLinmodMetadata = this.$( '<td>' ).addClass( 
've-ui-debugBar-dump-linmod-metadata' );
-       this.$dumpView = this.$( '<td>' ).addClass( 've-ui-debugBar-dump-view' 
);
-       this.$dumpModel = this.$( '<td>' ).addClass( 
've-ui-debugBar-dump-model' );
+       this.$commands = $( '<div>' ).addClass( 've-ui-debugBar-commands' );
+       this.$dumpLinmodData = $( '<td>' ).addClass( 
've-ui-debugBar-dump-linmod-data' );
+       this.$dumpLinmodMetadata = $( '<td>' ).addClass( 
've-ui-debugBar-dump-linmod-metadata' );
+       this.$dumpView = $( '<td>' ).addClass( 've-ui-debugBar-dump-view' );
+       this.$dumpModel = $( '<td>' ).addClass( 've-ui-debugBar-dump-model' );
 
        hideDumpButton = new OO.ui.ButtonWidget( {
-               $: this.$,
                label: 'Hide'
        } );
 
        this.$dump =
-               this.$( '<div class="ve-ui-debugBar-dump">' ).append(
+               $( '<div class="ve-ui-debugBar-dump">' ).append(
                        hideDumpButton.$element,
-                       this.$( '<table></table>' ).append(
-                               this.$( '<thead><th>Linear model 
data</th><th>Linear model metadata</th><th>View tree</th><th>Model 
tree</th></thead>' ),
-                               this.$( '<tbody>' ).append(
-                                       this.$( '<tr>' ).append(
+                       $( '<table></table>' ).append(
+                               $( '<thead><th>Linear model data</th><th>Linear 
model metadata</th><th>View tree</th><th>Model tree</th></thead>' ),
+                               $( '<tbody>' ).append(
+                                       $( '<tr>' ).append(
                                                this.$dumpLinmodData, 
this.$dumpLinmodMetadata, this.$dumpView, this.$dumpModel
                                        )
                                )
                        )
                ).hide();
 
-       this.$filibuster = this.$( '<div 
class="ve-ui-debugBar-filibuster"></div>' );
+       this.$filibuster = $( '<div class="ve-ui-debugBar-filibuster"></div>' );
 
        // Widgets
        this.selectionLabel = new OO.ui.LabelWidget( { classes: 
['ve-ui-debugBar-selectionLabel'] } );
@@ -79,7 +78,7 @@
                this.$commands.append(
                        this.selectionLabel.$element,
                        this.logRangeButton.$element,
-                       this.$( this.constructor.static.dividerTemplate ),
+                       $( this.constructor.static.dividerTemplate ),
                        dumpModelButtonGroup.$element,
                        this.inputDebuggingToggle.$element,
                        this.filibusterToggle.$element
@@ -170,20 +169,20 @@
  */
 ve.ui.DebugBar.prototype.generateListFromLinearData = function ( linearData ) {
        var i, $li, $label, element, text, annotations, data,
-               $ol = this.$( '<ol start="0"></ol>' );
+               $ol = $( '<ol start="0"></ol>' );
 
        data = linearData instanceof ve.dm.LinearData ? linearData.data : 
linearData;
 
        for ( i = 0; i < data.length; i++ ) {
-               $li = this.$( '<li>' );
-               $label = this.$( '<span>' );
+               $li = $( '<li>' );
+               $label = $( '<span>' );
                element = data[i];
                annotations = null;
                if ( linearData instanceof ve.dm.MetaLinearData ) {
                        if ( element && element.length ) {
                                $li.append( this.generateListFromLinearData( 
element ) );
                        } else {
-                               $li.append( this.$( '<span>undefined</span>' 
).addClass( 've-ui-debugBar-dump-undefined' ) );
+                               $li.append( $( '<span>undefined</span>' 
).addClass( 've-ui-debugBar-dump-undefined' ) );
                        }
                } else {
                        if ( element.type ) {
@@ -202,7 +201,7 @@
                        if ( annotations ) {
                                $label.append(
                                        /*jshint loopfunc:true */
-                                       this.$( '<span>' ).text(
+                                       $( '<span>' ).text(
                                                '[' + 
this.getSurface().getModel().getDocument().getStore().values( annotations 
).map( function ( ann ) {
                                                        return JSON.stringify( 
ann.getComparableObject() );
                                                } ).join( ', ' ) + ']'
@@ -225,17 +224,17 @@
  */
 ve.ui.DebugBar.prototype.generateListFromNode = function ( node ) {
        var $li, i, $label,
-               $ol = this.$( '<ol start="0"></ol>' );
+               $ol = $( '<ol start="0"></ol>' );
 
        for ( i = 0; i < node.children.length; i++ ) {
-               $li = this.$( '<li>' );
-               $label = this.$( '<span>' ).addClass( 
've-ui-debugBar-dump-element' );
+               $li = $( '<li>' );
+               $label = $( '<span>' ).addClass( 've-ui-debugBar-dump-element' 
);
                if ( node.children[i].length !== undefined ) {
                        $li.append(
                                $label
                                        .text( node.children[i].type )
                                        .append(
-                                               this.$( '<span>' ).text( ' (' + 
node.children[i].length + ')' )
+                                               $( '<span>' ).text( ' (' + 
node.children[i].length + ')' )
                                        )
                        );
                } else {
diff --git a/src/ui/ve.ui.DesktopContext.js b/src/ui/ve.ui.DesktopContext.js
index 1c78fc4..10b67de 100644
--- a/src/ui/ve.ui.DesktopContext.js
+++ b/src/ui/ve.ui.DesktopContext.js
@@ -19,11 +19,11 @@
        ve.ui.DesktopContext.super.call( this, surface, config );
 
        // Properties
-       this.popup = new OO.ui.PopupWidget( { $: this.$, $container: 
this.surface.$element } );
+       this.popup = new OO.ui.PopupWidget( { $container: this.surface.$element 
} );
        this.transitioning = null;
        this.suppressed = false;
        this.onWindowResizeHandler = this.onPosition.bind( this );
-       this.$window = this.$( this.getElementWindow() );
+       this.$window = $( this.getElementWindow() );
 
        // Events
        this.surface.getView().connect( this, {
@@ -125,7 +125,6 @@
  */
 ve.ui.DesktopContext.prototype.createInspectorWindowManager = function () {
        return new ve.ui.DesktopInspectorWindowManager( this.surface, {
-               $: this.$,
                factory: ve.ui.windowFactory,
                overlay: this.surface.getLocalOverlay(),
                modal: false
diff --git a/src/ui/ve.ui.DesktopSurface.js b/src/ui/ve.ui.DesktopSurface.js
index cea5abf..2dbd268 100644
--- a/src/ui/ve.ui.DesktopSurface.js
+++ b/src/ui/ve.ui.DesktopSurface.js
@@ -30,7 +30,7 @@
  * @inheritdoc
  */
 ve.ui.DesktopSurface.prototype.createContext = function () {
-       return new ve.ui.DesktopContext( this, { $: this.$ } );
+       return new ve.ui.DesktopContext( this );
 };
 
 /**
diff --git a/src/ui/ve.ui.MobileSurface.js b/src/ui/ve.ui.MobileSurface.js
index 65c4e9e..92bae8f 100644
--- a/src/ui/ve.ui.MobileSurface.js
+++ b/src/ui/ve.ui.MobileSurface.js
@@ -69,7 +69,7 @@
  * @inheritdoc
  */
 ve.ui.MobileSurface.prototype.createContext = function () {
-       return new ve.ui.MobileContext( this, { $: this.$ } );
+       return new ve.ui.MobileContext( this );
 };
 
 /**
diff --git a/src/ui/ve.ui.Surface.js b/src/ui/ve.ui.Surface.js
index 053543c..f64cf2f 100644
--- a/src/ui/ve.ui.Surface.js
+++ b/src/ui/ve.ui.Surface.js
@@ -33,11 +33,11 @@
        // Properties
        this.inDialog = config.inDialog || '';
        this.globalOverlay = new ve.ui.Overlay( { classes: 
['ve-ui-overlay-global'] } );
-       this.localOverlay = new ve.ui.Overlay( { $: this.$, classes: 
['ve-ui-overlay-local'] } );
-       this.$selections = this.$( '<div>' );
-       this.$blockers = this.$( '<div>' );
-       this.$controls = this.$( '<div>' );
-       this.$menus = this.$( '<div>' );
+       this.localOverlay = new ve.ui.Overlay( { classes: 
['ve-ui-overlay-local'] } );
+       this.$selections = $( '<div>' );
+       this.$blockers = $( '<div>' );
+       this.$controls = $( '<div>' );
+       this.$menus = $( '<div>' );
        this.triggerListener = new ve.TriggerListener( OO.simpleArrayDifference(
                Object.keys( ve.ui.commandRegistry.registry ), 
config.excludeCommands || []
        ) );
@@ -52,7 +52,7 @@
                documentModel = ve.dm.converter.getModelFromDom( dataOrDoc );
        }
        this.model = new ve.dm.Surface( documentModel );
-       this.view = new ve.ce.Surface( this.model, this, { $: this.$ } );
+       this.view = new ve.ce.Surface( this.model, this );
        this.dialogs = this.createDialogWindowManager();
        this.importRules = config.importRules || {};
        this.enabled = true;
@@ -64,7 +64,6 @@
 
        this.toolbarHeight = 0;
        this.toolbarDialogs = new ve.ui.ToolbarDialogWindowManager( this, {
-               $: this.$,
                factory: ve.ui.windowFactory,
                modal: false
        } );
diff --git a/src/ui/ve.ui.TableContext.js b/src/ui/ve.ui.TableContext.js
index 1699deb..5464023 100644
--- a/src/ui/ve.ui.TableContext.js
+++ b/src/ui/ve.ui.TableContext.js
@@ -30,13 +30,11 @@
        this.surface = tableNode.surface.getSurface();
        this.visible = false;
        this.indicator = new OO.ui.IndicatorWidget( {
-               $: this.$,
                classes: ['ve-ui-tableContext-indicator'],
                indicator: config.indicator
        } );
-       this.menu = new ve.ui.ContextSelectWidget( { $: this.$ } );
+       this.menu = new ve.ui.ContextSelectWidget();
        this.popup = new OO.ui.PopupWidget( {
-               $: this.$,
                $container: this.surface.$element,
                width: 150
        } );
@@ -71,7 +69,7 @@
        for ( i = 0, l = toolList.length; i < l; i++ ) {
                tool = ve.ui.toolFactory.lookup( toolList[i] );
                items.push( new ve.ui.ContextOptionWidget(
-                       tool, this.tableNode.getModel(), { $: this.$, data: 
tool.static.name }
+                       tool, this.tableNode.getModel(), { data: 
tool.static.name }
                ) );
        }
        this.menu.addItems( items );
diff --git a/src/ui/ve.ui.Toolbar.js b/src/ui/ve.ui.Toolbar.js
index 849a75f..0802c7f 100644
--- a/src/ui/ve.ui.Toolbar.js
+++ b/src/ui/ve.ui.Toolbar.js
@@ -23,7 +23,7 @@
        // Properties
        this.floating = false;
        this.floatable = !!config.floatable;
-       this.$window = this.$( this.getElementWindow() );
+       this.$window = $( this.getElementWindow() );
        this.elementOffset = null;
        this.windowEvents = {
                // Must use Function#bind (or a closure) instead of direct 
reference
diff --git a/src/ui/widgets/ve.ui.AlignWidget.js 
b/src/ui/widgets/ve.ui.AlignWidget.js
index 1e143ce..e434057 100644
--- a/src/ui/widgets/ve.ui.AlignWidget.js
+++ b/src/ui/widgets/ve.ui.AlignWidget.js
@@ -22,19 +22,16 @@
 
        var alignButtons = [
                        new OO.ui.ButtonOptionWidget( {
-                               $: this.$,
                                data: 'left',
                                icon: 'align-float-left',
                                label: ve.msg( 'visualeditor-align-widget-left' 
)
                        } ),
                        new OO.ui.ButtonOptionWidget( {
-                               $: this.$,
                                data: 'center',
                                icon: 'align-center',
                                label: ve.msg( 
'visualeditor-align-widget-center' )
                        } ),
                        new OO.ui.ButtonOptionWidget( {
-                               $: this.$,
                                data: 'right',
                                icon: 'align-float-right',
                                label: ve.msg( 
'visualeditor-align-widget-right' )
diff --git a/src/ui/widgets/ve.ui.DimensionsWidget.js 
b/src/ui/widgets/ve.ui.DimensionsWidget.js
index f4ae5d3..004959c 100644
--- a/src/ui/widgets/ve.ui.DimensionsWidget.js
+++ b/src/ui/widgets/ve.ui.DimensionsWidget.js
@@ -24,22 +24,16 @@
        // Parent constructor
        OO.ui.Widget.call( this, config );
 
-       this.widthInput = new OO.ui.TextInputWidget( {
-               $: this.$
-       } );
-       this.heightInput = new OO.ui.TextInputWidget( {
-               $: this.$
-       } );
+       this.widthInput = new OO.ui.TextInputWidget();
+       this.heightInput = new OO.ui.TextInputWidget();
 
        this.defaults = config.defaults || { width: '', height: '' };
        this.renderDefaults();
 
        labelTimes = new OO.ui.LabelWidget( {
-               $: this.$,
                label: ve.msg( 'visualeditor-dimensionswidget-times' )
        } );
        labelPx = new OO.ui.LabelWidget( {
-               $: this.$,
                label: ve.msg( 'visualeditor-dimensionswidget-px' )
        } );
 
diff --git a/src/ui/widgets/ve.ui.LanguageInputWidget.js 
b/src/ui/widgets/ve.ui.LanguageInputWidget.js
index 60b04db..02d6bc3 100644
--- a/src/ui/widgets/ve.ui.LanguageInputWidget.js
+++ b/src/ui/widgets/ve.ui.LanguageInputWidget.js
@@ -30,31 +30,25 @@
        this.dialogs = config.dialogManager || new ve.ui.WindowManager( { 
factory: ve.ui.windowFactory, isolate: true } );
        this.availableLanguages = config.availableLanguages;
        this.findLanguageButton = new OO.ui.ButtonWidget( {
-               $: this.$,
                classes: [ 've-ui-languageInputWidget-findLanguageButton' ],
                label: ve.msg( 
'visualeditor-languageinspector-widget-changelang' ),
                indicator: 'next'
        } );
        this.languageCodeTextInput = new OO.ui.TextInputWidget( {
-               $: this.$,
                classes: [ 've-ui-languageInputWidget-languageCodeTextInput' ]
        } );
        this.directionSelect = new OO.ui.ButtonSelectWidget( {
-               $: this.$,
                classes: [ 've-ui-languageInputWidget-directionSelect' ]
        } );
        this.findLanguageField = new OO.ui.FieldLayout( 
this.findLanguageButton, {
-               $: this.$,
                align: 'left',
                label: ve.msg( 
'visualeditor-languageinspector-widget-label-language' )
        } );
        this.languageCodeField = new OO.ui.FieldLayout( 
this.languageCodeTextInput, {
-               $: this.$,
                align: 'left',
                label: ve.msg( 
'visualeditor-languageinspector-widget-label-langcode' )
        } );
        this.directionField = new OO.ui.FieldLayout( this.directionSelect, {
-               $: this.$,
                align: 'left',
                label: ve.msg( 
'visualeditor-languageinspector-widget-label-direction' )
        } );
@@ -67,12 +61,10 @@
        // Initialization
        var dirItems = [
                new OO.ui.ButtonOptionWidget( {
-                       $: this.$,
                        data: 'rtl',
                        icon: 'text-dir-rtl'
                } ),
                new OO.ui.ButtonOptionWidget( {
-                       $: this.$,
                        data: 'ltr',
                        icon: 'text-dir-ltr'
                } )
@@ -80,7 +72,6 @@
        if ( !config.requireDir ) {
                dirItems.splice(
                        1, 0, new OO.ui.ButtonOptionWidget( {
-                               $: this.$,
                                data: null,
                                label: ve.msg( 
'visualeditor-dialog-language-auto-direction' )
                        } )
diff --git a/src/ui/widgets/ve.ui.LanguageResultWidget.js 
b/src/ui/widgets/ve.ui.LanguageResultWidget.js
index 3e370a6..c7b8c8a 100644
--- a/src/ui/widgets/ve.ui.LanguageResultWidget.js
+++ b/src/ui/widgets/ve.ui.LanguageResultWidget.js
@@ -19,8 +19,8 @@
 
        // Initialization
        this.$element.addClass( 've-ui-languageResultWidget' );
-       this.$name = this.$( '<div>' ).addClass( 
've-ui-languageResultWidget-name' );
-       this.$otherMatch = this.$( '<div>' ).addClass( 
've-ui-languageResultWidget-otherMatch' );
+       this.$name = $( '<div>' ).addClass( 've-ui-languageResultWidget-name' );
+       this.$otherMatch = $( '<div>' ).addClass( 
've-ui-languageResultWidget-otherMatch' );
        this.setLabel( this.$otherMatch.add( this.$name ) );
 };
 
@@ -65,7 +65,7 @@
  * @returns {jQuery} Text with query substring wrapped in highlighted span
  */
 ve.ui.LanguageResultWidget.prototype.highlightQuery = function ( text, query ) 
{
-       var $result = this.$( '<span>' ),
+       var $result = $( '<span>' ),
                offset = text.toLowerCase().indexOf( query.toLowerCase() );
 
        if ( !query.length || offset === -1 ) {
@@ -73,7 +73,7 @@
        }
        $result.append(
                document.createTextNode( text.slice( 0, offset ) ),
-               this.$( '<span>' )
+               $( '<span>' )
                        .addClass( 've-ui-languageResultWidget-highlight' )
                        .text( text.slice( offset, offset + query.length ) ),
                document.createTextNode( text.slice( offset + query.length ) )
diff --git a/src/ui/widgets/ve.ui.LanguageSearchWidget.js 
b/src/ui/widgets/ve.ui.LanguageSearchWidget.js
index 8619100..87a5c36 100644
--- a/src/ui/widgets/ve.ui.LanguageSearchWidget.js
+++ b/src/ui/widgets/ve.ui.LanguageSearchWidget.js
@@ -33,7 +33,6 @@
                languageCode = languageCodes[i];
                this.languageResultWidgets.push(
                        new ve.ui.LanguageResultWidget( {
-                               $: this.$,
                                data: {
                                        code: languageCode,
                                        name: ve.init.platform.getLanguageName( 
languageCode ),
diff --git a/src/ui/widgets/ve.ui.LinkTargetInputWidget.js 
b/src/ui/widgets/ve.ui.LinkTargetInputWidget.js
index 9d270c9..6e4a0d7 100644
--- a/src/ui/widgets/ve.ui.LinkTargetInputWidget.js
+++ b/src/ui/widgets/ve.ui.LinkTargetInputWidget.js
@@ -26,8 +26,6 @@
        this.$element.addClass( 've-ui-linkTargetInputWidget' );
 
        // Default RTL/LTR check
-       // Has to use global $() instead of this.$() because only the main 
document's <body> has
-       // the 'rtl' class; inspectors and dialogs have oo-ui-rtl instead.
        if ( $( 'body' ).hasClass( 'rtl' ) ) {
                this.$input.addClass( 'oo-ui-rtl' );
        }
@@ -53,8 +51,6 @@
                // Allow the stack to clear so the value will be updated
                setTimeout( function () {
                        // RTL/LTR check
-                       // Has to use global $() instead of this.$() because 
only the main document's <body> has
-                       // the 'rtl' class; inspectors and dialogs have 
oo-ui-rtl instead.
                        if ( $( 'body' ).hasClass( 'rtl' ) ) {
                                var isExt = 
ve.init.platform.getExternalLinkUrlProtocolsRegExp()
                                        .test( widget.$input.val() );
diff --git a/src/ui/widgets/ve.ui.MediaSizeWidget.js 
b/src/ui/widgets/ve.ui.MediaSizeWidget.js
index 85cf296..8e09152 100644
--- a/src/ui/widgets/ve.ui.MediaSizeWidget.js
+++ b/src/ui/widgets/ve.ui.MediaSizeWidget.js
@@ -34,53 +34,42 @@
 
        // Define button select widget
        this.sizeTypeSelectWidget = new OO.ui.ButtonSelectWidget( {
-               $: this.$,
                classes: [ 've-ui-mediaSizeWidget-section-sizetype' ]
        } );
        this.sizeTypeSelectWidget.addItems( [
                new OO.ui.ButtonOptionWidget( {
-                       $: this.$,
                        data: 'default',
                        label: ve.msg( 
'visualeditor-mediasizewidget-sizeoptions-default' )
                } ),
                // TODO: when upright is supported by Parsoid
                // new OO.ui.ButtonOptionWidget( {
-               // $: this.$,
                // data: 'scale',
                // label: ve.msg( 
'visualeditor-mediasizewidget-sizeoptions-scale' )
                // } ),
                new OO.ui.ButtonOptionWidget( {
-                       $: this.$,
                        data: 'custom',
                        label: ve.msg( 
'visualeditor-mediasizewidget-sizeoptions-custom' )
                } )
        ] );
 
        // Define scale
-       this.scaleInput = new OO.ui.TextInputWidget( {
-               $: this.$
-       } );
+       this.scaleInput = new OO.ui.TextInputWidget();
        scalePercentLabel = new OO.ui.LabelWidget( {
-               $: this.$,
                input: this.scaleInput,
                label: ve.msg( 
'visualeditor-mediasizewidget-label-scale-percent' )
        } );
 
-       this.dimensionsWidget = new ve.ui.DimensionsWidget( {
-               $: this.$
-       } );
+       this.dimensionsWidget = new ve.ui.DimensionsWidget();
 
        // Error label is available globally so it can be displayed and
        // hidden as needed
        this.errorLabel = new OO.ui.LabelWidget( {
-               $: this.$,
                label: ve.msg( 
'visualeditor-mediasizewidget-label-defaulterror' )
        } );
 
        // Field layouts
        fieldScale = new OO.ui.FieldLayout(
                this.scaleInput, {
-                       $: this.$,
                        align: 'right',
                        // TODO: when upright is supported by Parsoid
                        // classes: ['ve-ui-mediaSizeWidget-section-scale'],
@@ -91,7 +80,6 @@
        // this.scaleInput.$element.append( scalePercentLabel.$element );
        fieldCustom = new OO.ui.FieldLayout(
                this.dimensionsWidget, {
-                       $: this.$,
                        align: 'right',
                        label: ve.msg( 
'visualeditor-mediasizewidget-label-custom' ),
                        classes: ['ve-ui-mediaSizeWidget-section-custom']
@@ -100,7 +88,6 @@
 
        // Buttons
        this.fullSizeButton = new OO.ui.ButtonWidget( {
-               $: this.$,
                label: ve.msg( 
'visualeditor-mediasizewidget-button-originaldimensions' ),
                classes: ['ve-ui-mediaSizeWidget-button-fullsize']
        } );
@@ -114,7 +101,7 @@
                        // fieldScale.$element,
                        fieldCustom.$element,
                        this.fullSizeButton.$element,
-                       this.$( '<div>' )
+                       $( '<div>' )
                                .addClass( 've-ui-mediaSizeWidget-label-error' )
                                .append( this.errorLabel.$element )
                );
diff --git a/src/ui/widgets/ve.ui.SurfaceWidget.js 
b/src/ui/widgets/ve.ui.SurfaceWidget.js
index c546ae5..84473e1 100644
--- a/src/ui/widgets/ve.ui.SurfaceWidget.js
+++ b/src/ui/widgets/ve.ui.SurfaceWidget.js
@@ -28,7 +28,6 @@
 
        // Properties
        this.surface = ve.init.target.createSurface( doc, {
-               $: this.$,
                excludeCommands: config.excludeCommands,
                importRules: config.importRules,
                inDialog: config.inDialog

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I29127d3f084d7f05a4c48ba29c42a3f1827a0957
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Catrope <[email protected]>

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

Reply via email to