ve-cite: Show $originalRefList even if there are no refs in the model

This original use case at T187495 is for he.wiki, where it is likely
that all the references are defined in templates, so the model
will always be empty, even though $originalRefList is populated.

Change-Id: Ia2785a20bf82ab97466276a57936bc9299e1cabe
This commit is contained in:
Ed Sanders 2023-02-22 17:19:22 +00:00
parent d190578c9c
commit 59d900d951

View file

@ -186,11 +186,13 @@ ve.ce.MWReferencesListNode.prototype.update = function () {
this.$originalRefList = $( ve.copyDomElements( model.getStore().value(
model.getElement().originalDomElementsHash
), document ) );
if ( !nodes || !nodes.indexOrder.length ) {
// Check for references in the model. If none are found do a slower check
// to see if $originalRefList has any, as they could all be defined in templates.
if ( ( nodes && nodes.indexOrder.length ) || this.$originalRefList.find( 'li' ).length ) {
this.$element.append( this.$originalRefList );
} else {
this.$refmsg.text( emptyText );
this.$element.append( this.$refmsg );
} else {
this.$element.append( this.$originalRefList );
}
return;
}