jenkins-bot has submitted this change and it was merged.

Change subject: Fix transclusion node cloneElement method
......................................................................


Fix transclusion node cloneElement method

* Override the static cloneElement. getClonedElement shouldn't
  be overridden as doing so misses static invocations.
* Apply the same fix to extension nodes
* Fix DOM loop to reference clone.originalDomElements[ i ]

Logically depends on Id8024c171c to work.

Bug: T126169
Bug: T126114
Change-Id: Icf4d3115db5b12b97a6c805ff3d0b71d9e88b804
---
M modules/ve-mw/dm/nodes/ve.dm.MWExtensionNode.js
M modules/ve-mw/dm/nodes/ve.dm.MWTransclusionNode.js
2 files changed, 35 insertions(+), 14 deletions(-)

Approvals:
  Esanders: 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 3ad5c15..0d604e0 100644
--- a/modules/ve-mw/dm/nodes/ve.dm.MWExtensionNode.js
+++ b/modules/ve-mw/dm/nodes/ve.dm.MWExtensionNode.js
@@ -77,6 +77,24 @@
        return dataElement;
 };
 
+/** */
+ve.dm.MWExtensionNode.static.cloneElement = function () {
+       // TODO: This is the same as 
ve.dm.MWTransclusionnode.static.cloneElement, find a way
+       // to de-duplicate this method.
+       var i, len,
+               // Parent method
+               clone = ve.dm.MWExtensionNode.super.static.cloneElement.apply( 
this, arguments );
+
+       delete clone.attributes.originalMw;
+       // Remove about attribute to prevent about grouping of duplicated 
transclusions
+       if ( clone.originalDomElements ) {
+               for ( i = 0, len = clone.originalDomElements.length; i < len; 
i++ ) {
+                       clone.originalDomElements[ i ].removeAttribute( 'about' 
);
+               }
+       }
+       return clone;
+};
+
 ve.dm.MWExtensionNode.static.toDomElements = function ( dataElement, doc, 
converter ) {
        var el, els, index,
                store = converter.getStore(),
diff --git a/modules/ve-mw/dm/nodes/ve.dm.MWTransclusionNode.js 
b/modules/ve-mw/dm/nodes/ve.dm.MWTransclusionNode.js
index 7309bdc..cbdc45b 100644
--- a/modules/ve-mw/dm/nodes/ve.dm.MWTransclusionNode.js
+++ b/modules/ve-mw/dm/nodes/ve.dm.MWTransclusionNode.js
@@ -20,7 +20,7 @@
  */
 ve.dm.MWTransclusionNode = function VeDmMWTransclusionNode() {
        // Parent constructor
-       ve.dm.LeafNode.apply( this, arguments );
+       ve.dm.MWTransclusionNode.super.apply( this, arguments );
 
        // Mixin constructors
        ve.dm.GeneratedContentNode.call( this );
@@ -189,6 +189,22 @@
                ve.resolveAttributes( $( els ), doc, 
ve.dm.Converter.static.computedAttributes );
        }
        return els;
+};
+
+/** */
+ve.dm.MWTransclusionNode.static.cloneElement = function () {
+       var i, len,
+               // Parent method
+               clone = 
ve.dm.MWTransclusionNode.super.static.cloneElement.apply( this, arguments );
+
+       delete clone.attributes.originalMw;
+       // Remove about attribute to prevent about grouping of duplicated 
transclusions
+       if ( clone.originalDomElements ) {
+               for ( i = 0, len = clone.originalDomElements.length; i < len; 
i++ ) {
+                       clone.originalDomElements[ i ].removeAttribute( 'about' 
);
+               }
+       }
+       return clone;
 };
 
 /**
@@ -374,19 +390,6 @@
                }
        }
        return wikitext;
-};
-
-/** */
-ve.dm.MWTransclusionNode.prototype.getClonedElement = function () {
-       var i, len, clone = ve.dm.LeafNode.prototype.getClonedElement.call( 
this );
-       delete clone.attributes.originalMw;
-       // Remove about attribute to prevent about grouping of duplicated 
transclusions
-       if ( clone.originalDomElements ) {
-               for ( i = 0, len = clone.originalDomElements.length; i < len; 
i++ ) {
-                       clone.originalDomElements.removeAttribute( 'about' );
-               }
-       }
-       return clone;
 };
 
 /* Concrete subclasses */

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Icf4d3115db5b12b97a6c805ff3d0b71d9e88b804
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <esand...@wikimedia.org>
Gerrit-Reviewer: Catrope <roan.katt...@gmail.com>
Gerrit-Reviewer: DLynch <dly...@wikimedia.org>
Gerrit-Reviewer: Divec <da...@troi.org>
Gerrit-Reviewer: Esanders <esand...@wikimedia.org>
Gerrit-Reviewer: Jforrester <jforres...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to