diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWTransclusionOutlineContainerWidget.js b/modules/ve-mw/ui/widgets/ve.ui.MWTransclusionOutlineContainerWidget.js index a10a255647..1a4695493c 100644 --- a/modules/ve-mw/ui/widgets/ve.ui.MWTransclusionOutlineContainerWidget.js +++ b/modules/ve-mw/ui/widgets/ve.ui.MWTransclusionOutlineContainerWidget.js @@ -110,7 +110,7 @@ ve.ui.MWTransclusionOutlineContainerWidget.prototype.addPartWidget = function ( widget = new ve.ui.MWTransclusionOutlineWikitextWidget( part ); } - widget.connect( this, { partHeaderClick: 'focusPart' } ); + widget.connect( this, { headerClick: 'focusPart' } ); this.partWidgets[ part.getId() ] = widget; if ( typeof newPosition === 'number' && newPosition < this.$element.children().length ) { diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWTransclusionOutlinePartWidget.js b/modules/ve-mw/ui/widgets/ve.ui.MWTransclusionOutlinePartWidget.js index 14d8a9be2e..84f53de709 100644 --- a/modules/ve-mw/ui/widgets/ve.ui.MWTransclusionOutlinePartWidget.js +++ b/modules/ve-mw/ui/widgets/ve.ui.MWTransclusionOutlinePartWidget.js @@ -20,20 +20,16 @@ */ ve.ui.MWTransclusionOutlinePartWidget = function VeUiMWTransclusionOutlinePartWidget( part, config ) { // Parent constructor - ve.ui.MWTransclusionOutlinePartWidget.super.call( this, config ); + ve.ui.MWTransclusionOutlinePartWidget.super.call( this, ve.extendObject( config, { + data: part.getId() + } ) ); - // FIXME: Use config.data and OO.ui.Element.getData() instead? - // Warning, there is already config.id and this.elementId! - this.partId = part.getId(); - - this.header = new ve.ui.MWTransclusionOutlineButtonWidget( config ) + var header = new ve.ui.MWTransclusionOutlineButtonWidget( config ) .connect( this, { click: 'onHeaderClick' } ); this.$element .addClass( 've-ui-mwTransclusionOutlinePartWidget' ) - // Note: There is no code that uses this. It just helps when manually inspecting the HTML. - .attr( 'data-transclusion-part-id', part.getId() ) - .append( this.header.$element ); + .append( header.$element ); }; /* Inheritance */ @@ -43,20 +39,13 @@ OO.inheritClass( ve.ui.MWTransclusionOutlinePartWidget, OO.ui.Widget ); /* Events */ /** - * @event partHeaderClick + * @event headerClick * @param {string} partId */ /** - * @return {string} Identifier of the {@see ve.dm.MWTransclusionPartModel} this widget represents - */ -ve.ui.MWTransclusionOutlinePartWidget.prototype.getPartId = function () { - return this.partId; -}; - -/** - * @fires partHeaderClick + * @fires headerClick */ ve.ui.MWTransclusionOutlinePartWidget.prototype.onHeaderClick = function () { - this.emit( 'partHeaderClick', this.partId ); + this.emit( 'headerClick', this.data ); };