jenkins-bot has submitted this change and it was merged. Change subject: Use an es6 Set to track templates. ......................................................................
Use an es6 Set to track templates. Change-Id: I7ec659b3a5da6f44f5d2aad8729a3db60e7dd4e3 --- M lib/index.js 1 file changed, 4 insertions(+), 4 deletions(-) Approvals: Cscott: Looks good to me, approved jenkins-bot: Verified diff --git a/lib/index.js b/lib/index.js index 107ce8f..0f00ec0 100644 --- a/lib/index.js +++ b/lib/index.js @@ -511,7 +511,7 @@ this.format = format; this.options = options; this.output = []; - this.templates = Object.create(null); + this.templates = new Set(); this.base = options.base || ''; this.currentLanguage = this.tocLanguage = options.lang || 'en'; this.currentDirectionality = options.dir || 'ltr'; @@ -900,8 +900,8 @@ // tables Visitor.prototype.visitTABLE = function(node) { - if (node.getAttribute('about') in this.templates) { - return; + if (this.templates.has(node.getAttribute('about'))) { + return; // already handled } // xxx hide all tables for now }; @@ -1038,7 +1038,7 @@ // hack to support double/triple image template Visitor.prototype.visitMultipleImage = function(node) { var about = node.getAttribute('about'); - this.templates[about] = true; + this.templates.add(about); node = node.parentElement; // hop up one level so we can see siblings var sel = 'table[about="' + about + '"] tr '; var images = node.querySelectorAll(sel + '> td > *[typeof="mw:Image"]'); -- To view, visit https://gerrit.wikimedia.org/r/107583 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I7ec659b3a5da6f44f5d2aad8729a3db60e7dd4e3 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Collection/OfflineContentGenerator/latex_renderer Gerrit-Branch: master Gerrit-Owner: Cscott <canan...@wikimedia.org> Gerrit-Reviewer: Cscott <canan...@wikimedia.org> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits