[refactor] InternalList isn't state

We've almost finished decoupling, and the last remaining usages of
InternalList can be inlined.

Change-Id: I0809df9d3c24fdd5fe4c628420d0406e012a3259
This commit is contained in:
Adam Wight 2024-09-03 11:34:47 +02:00
parent 4d8cb0d18a
commit e3398577c1

View file

@ -24,8 +24,6 @@ ve.ce.MWReferencesListNode = function VeCeMWReferencesListNode() {
ve.ce.FocusableNode.call( this );
// Properties
this.internalList = null;
this.listNode = null;
this.modified = false;
// DOM changes
@ -89,11 +87,11 @@ ve.ce.MWReferencesListNode.prototype.getExtraHighlightClasses = function () {
* Handle setup events.
*/
ve.ce.MWReferencesListNode.prototype.onSetup = function () {
this.internalList = this.getModel().getDocument().getInternalList();
this.listNode = this.internalList.getListNode();
const internalList = this.getModel().getDocument().getInternalList();
const listNode = internalList.getListNode();
this.internalList.connect( this, { update: 'onInternalListUpdate' } );
this.listNode.connect( this, { update: 'onListNodeUpdate' } );
internalList.connect( this, { update: 'onInternalListUpdate' } );
listNode.connect( this, { update: 'onListNodeUpdate' } );
// Parent method
ve.ce.MWReferencesListNode.super.prototype.onSetup.call( this );
@ -106,15 +104,11 @@ ve.ce.MWReferencesListNode.prototype.onTeardown = function () {
// Parent method
ve.ce.MWReferencesListNode.super.prototype.onTeardown.call( this );
if ( !this.listNode ) {
return;
}
const internalList = this.getModel().getDocument().getInternalList();
const listNode = internalList.getListNode();
this.internalList.disconnect( this, { update: 'onInternalListUpdate' } );
this.listNode.disconnect( this, { update: 'onListNodeUpdate' } );
this.internalList = null;
this.listNode = null;
internalList.disconnect( this, { update: 'onInternalListUpdate' } );
listNode.disconnect( this, { update: 'onListNodeUpdate' } );
};
/**