jenkins-bot has submitted this change and it was merged.
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, 6 insertions(+), 4 deletions(-)
Approvals:
Catrope: Looks good to me, approved
jenkins-bot: Verified
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..875642e 100644
--- a/modules/ve-mw/dm/nodes/ve.dm.MWTransclusionNode.js
+++ b/modules/ve-mw/dm/nodes/ve.dm.MWTransclusionNode.js
@@ -90,14 +90,16 @@
ve.dm.MWTransclusionNode.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
// 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: merged
Gerrit-Change-Id: I886e369ced9a9d2e0e457ced9c21b2a7a8e55d58
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits