ArticleTarget: Don't throw error on new heading node

Change-Id: I4e0566de9ffa2112d99d9d574621ce57ce8b37f2
This commit is contained in:
Ed Sanders 2024-11-22 14:46:11 +00:00 committed by Esanders
parent b9d1106eb0
commit 2fb7b81caf

View file

@ -2114,7 +2114,7 @@ ve.init.mw.ArticleTarget.prototype.restoreEditSection = function () {
dmDoc.getNodesByType( 'mwHeading' ).some( ( heading ) => {
const domElements = heading.getOriginalDomElements( dmDoc.getStore() );
if (
domElements && domElements[ 0 ].nodeType === Node.ELEMENT_NODE &&
domElements && domElements.length && domElements[ 0 ].nodeType === Node.ELEMENT_NODE &&
domElements[ 0 ].getAttribute( 'data-mw-section-id' ) === section
) {
headingModel = heading;