Use stricter test for originalDomElementsIndex

Change-Id: I43a0f639fa50fb2bbe9f935dd141d595571d8e24
This commit is contained in:
Ed Sanders 2016-11-02 12:51:10 +00:00
parent a42c656c53
commit 4c0e837dad
2 changed files with 2 additions and 2 deletions

View file

@ -216,7 +216,7 @@ ve.dm.MWReferenceNode.static.toDomElements = function ( dataElement, doc, conver
el.setAttribute( 'data-mw', originalMw ); el.setAttribute( 'data-mw', originalMw );
// Return the original DOM elements if possible // Return the original DOM elements if possible
if ( dataElement.originalDomElementsIndex ) { if ( dataElement.originalDomElementsIndex !== undefined ) {
return ve.copyDomElements( converter.getStore().value( dataElement.originalDomElementsIndex ), doc ); return ve.copyDomElements( converter.getStore().value( dataElement.originalDomElementsIndex ), doc );
} }
} else { } else {

View file

@ -80,7 +80,7 @@ ve.dm.MWReferencesListNode.static.toDomElements = function ( data, doc, converte
attribs = dataElement.attributes, attribs = dataElement.attributes,
contentsData = data.slice( 1, -1 ); contentsData = data.slice( 1, -1 );
if ( dataElement.originalDomElementsIndex ) { if ( dataElement.originalDomElementsIndex !== undefined ) {
// If there's more than 1 element, preserve entire array, not just first element // If there's more than 1 element, preserve entire array, not just first element
els = ve.copyDomElements( converter.getStore().value( dataElement.originalDomElementsIndex ), doc ); els = ve.copyDomElements( converter.getStore().value( dataElement.originalDomElementsIndex ), doc );
} else { } else {