From 27799ea9b59f5e86ec156947a39704959b92c1c4 Mon Sep 17 00:00:00 2001 From: Arlo Breault Date: Mon, 23 Oct 2017 17:35:49 -0400 Subject: [PATCH] There's only one refInRefProcessor * Avoid the unnecessary binding. Change-Id: I80e558a86eb7197ce39a07062499ec58f170a3af --- lib/ext/Cite/index.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/lib/ext/Cite/index.js b/lib/ext/Cite/index.js index 61b3addbc..e54eb7544 100644 --- a/lib/ext/Cite/index.js +++ b/lib/ext/Cite/index.js @@ -385,8 +385,10 @@ References.prototype.tokenHandler = function(manager, pipelineOpts, refsTok, cb) }); }; -References.prototype.extractRefFromNode = function(node, refsData, - refInRefProcessor, referencesAboutId, referencesGroup, nestedRefsHTML) { +var _processRefs; + +References.prototype.extractRefFromNode = function(node, refsData, cite, + referencesAboutId, referencesGroup, nestedRefsHTML) { var nestedInReferences = referencesAboutId !== undefined; var dp = DU.getDataParsoid(node); // SSS FIXME: Need to clarify semantics here. @@ -407,7 +409,7 @@ References.prototype.extractRefFromNode = function(node, refsData, if (dp.hasRefInRef) { var html = DU.ppToDOM(content); - refInRefProcessor(html); + _processRefs(cite, refsData, html); content = DU.ppToXML(html, { innerXML: true }); } @@ -637,9 +639,7 @@ References.prototype.serialHandler = { * foo * bar * -------------------------------------------- */ -var _processRefs, _processRefsInReferences; - -_processRefsInReferences = function(cite, refsData, node, referencesId, +var _processRefsInReferences = function(cite, refsData, node, referencesId, referencesGroup, nestedRefsHTML) { var child = node.firstChild; while (child !== null) { @@ -647,8 +647,7 @@ _processRefsInReferences = function(cite, refsData, node, referencesId, if (DU.isElt(child)) { var typeOf = child.getAttribute('typeof'); if ((/(?:^|\s)mw:Extension\/ref\/Marker(?=$|\s)/).test(typeOf)) { - cite.references.extractRefFromNode(child, refsData, - _processRefs.bind(null, cite, refsData), + cite.references.extractRefFromNode(child, refsData, cite, referencesId, referencesGroup, nestedRefsHTML); } else if (child.hasChildNodes()) { _processRefsInReferences(cite, refsData, @@ -667,8 +666,7 @@ _processRefs = function(cite, refsData, node) { if (DU.isElt(child)) { var typeOf = child.getAttribute('typeof'); if ((/(?:^|\s)mw:Extension\/ref\/Marker(?=$|\s)/).test(typeOf)) { - cite.references.extractRefFromNode(child, refsData, - _processRefs.bind(null, cite, refsData)); + cite.references.extractRefFromNode(child, refsData, cite); } else if ((/(?:^|\s)mw:Extension\/references(?=$|\s)/).test(typeOf)) { var referencesId = child.getAttribute("about"); var referencesGroup = DU.getDataParsoid(child).group;