Esanders has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/101228


Change subject: Fix hashes in MW toDomElement functions
......................................................................

Fix hashes in MW toDomElement functions

Hashes weren't using the new [ object, config ] set up so were
never matching the store. Also added a check to see if the
originalDomElements actually exists before trying to use them
(they may have been removed by a clone operation).

Change-Id: I886e369ced9a9d2e0e457ced9c21b2a7a8e55d58
---
M modules/ve-mw/dm/nodes/ve.dm.MWExtensionNode.js
M modules/ve-mw/dm/nodes/ve.dm.MWTransclusionNode.js
2 files changed, 7 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor 
refs/changes/28/101228/1

diff --git a/modules/ve-mw/dm/nodes/ve.dm.MWExtensionNode.js 
b/modules/ve-mw/dm/nodes/ve.dm.MWExtensionNode.js
index 8f568da..fff60a7 100644
--- a/modules/ve-mw/dm/nodes/ve.dm.MWExtensionNode.js
+++ b/modules/ve-mw/dm/nodes/ve.dm.MWExtensionNode.js
@@ -74,7 +74,7 @@
 
 ve.dm.MWExtensionNode.static.toDomElements = function ( dataElement, doc, 
converter ) {
        var el,
-               index = converter.getStore().indexOfHash( OO.getHash( 
this.getHashObject( dataElement ) ) ),
+               index = converter.getStore().indexOfHash( OO.getHash( [ 
this.getHashObject( dataElement ), undefined ] ) ),
                originalMw = dataElement.attributes.originalMw;
 
        // If the transclusion is unchanged just send back the
diff --git a/modules/ve-mw/dm/nodes/ve.dm.MWTransclusionNode.js 
b/modules/ve-mw/dm/nodes/ve.dm.MWTransclusionNode.js
index 1407c15..f7e0733 100644
--- a/modules/ve-mw/dm/nodes/ve.dm.MWTransclusionNode.js
+++ b/modules/ve-mw/dm/nodes/ve.dm.MWTransclusionNode.js
@@ -89,15 +89,17 @@
 };
 
 ve.dm.MWTransclusionNode.static.toDomElements = function ( dataElement, doc, 
converter ) {
-       var el,
-               index = converter.getStore().indexOfHash( OO.getHash( 
this.getHashObject( dataElement ) ) ),
+       var els, currentDom, i, len,
+               index = converter.getStore().indexOfHash( OO.getHash( [ 
this.getHashObject( dataElement ), undefined ] ) ),
                originalMw = dataElement.attributes.originalMw;
 
        // If the transclusion is unchanged just send back the
        // original DOM elements so selser can skip over it
        if (
-               index === dataElement.attributes.originalIndex ||
-               ( originalMw && ve.compare( dataElement.attributes.mw, 
JSON.parse( originalMw ) ) )
+               dataElement.attributes.originalDomElements && (
+                       index === dataElement.attributes.originalIndex ||
+                       ( originalMw && ve.compare( dataElement.attributes.mw, 
JSON.parse( originalMw ) ) )
+               )
        ) {
                // The object in the store is also used for CE rendering so 
return a copy
                return ve.copyDomElements( 
dataElement.attributes.originalDomElements, doc );

-- 
To view, visit https://gerrit.wikimedia.org/r/101228
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I886e369ced9a9d2e0e457ced9c21b2a7a8e55d58
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <esand...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to