Merge "[refactor] InternalList isn't state"

This commit is contained in:
jenkins-bot 2024-09-03 12:47:12 +00:00 committed by Gerrit Code Review
commit 30b5fca6ee

View file

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