mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-11-15 10:59:56 +00:00
Move originalDomElements to IV store and use new hash
Depends-On: I8a71c1a40ec35108d0a9a388da6f75632f8dc53c Depends-On: I0fbb6324eede94558426178cbdad6b5daf0f8318 Change-Id: I32c9b5f984fcf96e3354841ecfcd444149e8f159
This commit is contained in:
parent
8944130bbe
commit
fc4788d51b
|
@ -184,9 +184,7 @@ QUnit.test( 'newFromDocumentInsertion with references', function ( assert ) {
|
|||
actualStoreItems = [];
|
||||
expectedStoreItems = cases[ i ].expectedStoreItems || [];
|
||||
for ( j = 0; j < expectedStoreItems.length; j++ ) {
|
||||
actualStoreItems[ j ] = doc.store.value( doc.store.indexOfHash(
|
||||
OO.getHash( expectedStoreItems[ j ] )
|
||||
) );
|
||||
actualStoreItems[ j ] = doc.store.value( OO.getHash( expectedStoreItems[ j ] ) );
|
||||
}
|
||||
assert.deepEqual( actualStoreItems, expectedStoreItems, cases[ i ].msg + ': store items' );
|
||||
}
|
||||
|
|
|
@ -216,8 +216,8 @@ ve.dm.MWReferenceNode.static.toDomElements = function ( dataElement, doc, conver
|
|||
el.setAttribute( 'data-mw', originalMw );
|
||||
|
||||
// Return the original DOM elements if possible
|
||||
if ( dataElement.originalDomElements ) {
|
||||
return ve.copyDomElements( dataElement.originalDomElements, doc );
|
||||
if ( dataElement.originalDomElementsIndex ) {
|
||||
return ve.copyDomElements( converter.getStore().value( dataElement.originalDomElementsIndex ), doc );
|
||||
}
|
||||
} else {
|
||||
el.setAttribute( 'data-mw', JSON.stringify( mwData ) );
|
||||
|
|
|
@ -80,13 +80,11 @@ ve.dm.MWReferencesListNode.static.toDomElements = function ( data, doc, converte
|
|||
attribs = dataElement.attributes,
|
||||
contentsData = data.slice( 1, -1 );
|
||||
|
||||
if ( dataElement.originalDomElements ) {
|
||||
if ( dataElement.originalDomElementsIndex ) {
|
||||
// If there's more than 1 element, preserve entire array, not just first element
|
||||
els = ve.copyDomElements( dataElement.originalDomElements, doc );
|
||||
el = els[ 0 ];
|
||||
els = ve.copyDomElements( converter.getStore().value( dataElement.originalDomElementsIndex ), doc );
|
||||
} else {
|
||||
el = doc.createElement( 'div' );
|
||||
els = [ el ];
|
||||
els = [ doc.createElement( 'div' ) ];
|
||||
}
|
||||
|
||||
mwData = attribs.mw ? ve.copy( attribs.mw ) : {};
|
||||
|
@ -99,6 +97,7 @@ ve.dm.MWReferencesListNode.static.toDomElements = function ( data, doc, converte
|
|||
delete mwData.attrs.refGroup;
|
||||
}
|
||||
|
||||
el = els[ 0 ];
|
||||
el.setAttribute( 'typeof', 'mw:Extension/references' );
|
||||
|
||||
if ( contentsData.length > 2 ) {
|
||||
|
|
Loading…
Reference in a new issue