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

Change subject: Only generate transclusion contents for clipboard
......................................................................


Only generate transclusion contents for clipboard

Parsoid doesn't care about the transclusion contents and it can
cause bugs if not removed properly. Remove the about group attribute
as that was for Parsoid's benefit.

Depends on Ib29972472d in core.

Bug: 60897
Change-Id: I907b2113c257baff5c022ff0749dca9dbb1fba5f
---
M modules/ve-mw/dm/nodes/ve.dm.MWTransclusionNode.js
1 file changed, 17 insertions(+), 19 deletions(-)

Approvals:
  Catrope: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/ve-mw/dm/nodes/ve.dm.MWTransclusionNode.js 
b/modules/ve-mw/dm/nodes/ve.dm.MWTransclusionNode.js
index e4ea057..66af161 100644
--- a/modules/ve-mw/dm/nodes/ve.dm.MWTransclusionNode.js
+++ b/modules/ve-mw/dm/nodes/ve.dm.MWTransclusionNode.js
@@ -89,7 +89,7 @@
 };
 
 ve.dm.MWTransclusionNode.static.toDomElements = function ( dataElement, doc, 
converter ) {
-       var els, currentDom, i, len, wrapper, aboutGroup,
+       var els, currentDom, i, len, wrapper,
                index = converter.getStore().indexOfHash( OO.getHash( [ 
this.getHashObject( dataElement ), undefined ] ) ),
                originalMw = dataElement.attributes.originalMw;
 
@@ -108,26 +108,24 @@
                        els = [ doc.createElement( 
dataElement.attributes.originalDomElements[0].nodeName ) ];
                } else {
                        els = [ doc.createElement( 'span' ) ];
-                       // For the clipboard use the current DOM contents but 
mark as ignored
-                       // for the converter
-                       currentDom = converter.getStore().value( index );
-                       // About-group elements together
-                       aboutGroup = 'g' + Math.random();
-                       if ( currentDom ) {
-                               currentDom = ve.copyDomElements( currentDom, 
doc );
-                               // i = 0 is the data-mw span
-                               for ( i = 1, len = currentDom.length; i < len; 
i++ ) {
-                                       // Wrap plain text nodes so we can give 
them an attribute
-                                       if ( currentDom[i].nodeType === 
Node.TEXT_NODE ) {
-                                               wrapper = doc.createElement( 
'span' );
-                                               wrapper.appendChild( 
currentDom[i] );
-                                               currentDom[i] = wrapper;
+                       if ( converter.isForClipboard() ) {
+                               // For the clipboard use the current DOM 
contents but mark as ignored
+                               // for the converter
+                               currentDom = converter.getStore().value( index 
);
+                               if ( currentDom ) {
+                                       currentDom = ve.copyDomElements( 
currentDom, doc );
+                                       // i = 0 is the data-mw span
+                                       for ( i = 1, len = currentDom.length; i 
< len; i++ ) {
+                                               // Wrap plain text nodes so we 
can give them an attribute
+                                               if ( currentDom[i].nodeType === 
Node.TEXT_NODE ) {
+                                                       wrapper = 
doc.createElement( 'span' );
+                                                       wrapper.appendChild( 
currentDom[i] );
+                                                       currentDom[i] = wrapper;
+                                               }
+                                               currentDom[i].setAttribute( 
'data-ve-ignore', 'true' );
+                                               els.push( currentDom[i] );
                                        }
-                                       currentDom[i].setAttribute( 
'data-ve-ignore', 'true' );
-                                       currentDom[i].setAttribute( 'about', 
aboutGroup );
-                                       els.push( currentDom[i] );
                                }
-                               els[0].setAttribute( 'about', aboutGroup );
                        }
                }
                // All we need to send back to Parsoid is the original 
transclusion marker, with a

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I907b2113c257baff5c022ff0749dca9dbb1fba5f
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <esand...@wikimedia.org>
Gerrit-Reviewer: Catrope <roan.katt...@gmail.com>
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