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

Change subject: Don't emit foster box in transclusion
......................................................................


Don't emit foster box in transclusion

In d05894f170ba8e9a712099d3e6e6cd48ff53808d we removed encapsulation when
the associated table was in transclusion. This goes one step further and
avoids emitting it altogether. It shouldn't be needed and is breaking in
the odd unbalanced table situations.

Adds an assertion that the table is a sibling of the foster box.

Bug: 55820
Change-Id: I8424f4c3ec4de6c2b9072cb1712ae0ca4b312536
---
M js/lib/dom.markFosteredContent.js
M js/lib/mediawiki.HTML5TreeBuilder.node.js
2 files changed, 16 insertions(+), 12 deletions(-)

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



diff --git a/js/lib/dom.markFosteredContent.js 
b/js/lib/dom.markFosteredContent.js
index a0b6c0b..92f205f 100644
--- a/js/lib/dom.markFosteredContent.js
+++ b/js/lib/dom.markFosteredContent.js
@@ -103,11 +103,12 @@
                                sibling = next;
                        }
 
+                       // we should be able to reach the table from the 
fosterbox
+                       console.assert( sibling && DU.isElt( sibling ) && 
DU.hasNodeName( sibling, "table" ), "Table isn't a sibling. Something's amiss!" 
);
+
                        // we have fostered transclusions
                        // wrap the whole thing in a transclusion
-                       // But, skip if foster box itself is in transclusion
-                       // avoid unnecessary insertions and case where table 
doesn't have tsr info
-                       if ( fosteredTransclusions && 
!c.data.parsoid.inTransclusion ) {
+                       if ( fosteredTransclusions ) {
                                insertTransclusionMetas( env, c, sibling );
                        }
 
diff --git a/js/lib/mediawiki.HTML5TreeBuilder.node.js 
b/js/lib/mediawiki.HTML5TreeBuilder.node.js
index 9a909ba..e028240 100644
--- a/js/lib/mediawiki.HTML5TreeBuilder.node.js
+++ b/js/lib/mediawiki.HTML5TreeBuilder.node.js
@@ -211,17 +211,20 @@
                case TagTk:
                        tName = token.name;
                        if ( tName === "table" ) {
-                               if ( this.trace ) {
-                                       console.warn('inserting foster box 
meta');
-                               }
-                               attrs = [{ name: "typeof", value: 
"mw:FosterBox" }];
-                               if ( this.inTransclusion ) {
-                                       attrs.push({
-                                               name: "data-parsoid",
-                                               value: JSON.stringify({ 
inTransclusion: true })
+                               // Don't add foster box in transclusion
+                               // Avoids unnecessary insertions, the case 
where a table
+                               // doesn't have tsr info, and the messy 
unbalanced table case,
+                               // like the navbox
+                               if ( !this.inTransclusion ) {
+                                       if ( this.trace ) {
+                                               console.warn('inserting foster 
box meta');
+                                       }
+                                       this.emit('token', {
+                                               type: 'StartTag',
+                                               name: 'meta',
+                                               data: [ { name: "typeof", 
value: "mw:FosterBox" } ]
                                        });
                                }
-                               this.emit('token', { type: 'StartTag', name: 
'meta', data: attrs });
                        }
                        this.emit('token', {type: 'StartTag', name: tName, 
data: this._att(attribs)});
                        attrs = [];

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I8424f4c3ec4de6c2b9072cb1712ae0ca4b312536
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: Arlolra <[email protected]>
Gerrit-Reviewer: Arlolra <[email protected]>
Gerrit-Reviewer: Subramanya Sastry <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to