There's only one refInRefProcessor

* Avoid the unnecessary binding.

Change-Id: I80e558a86eb7197ce39a07062499ec58f170a3af
This commit is contained in:
Arlo Breault 2017-10-23 17:35:49 -04:00 committed by Subramanya Sastry
parent 23db74cd9c
commit 27799ea9b5

View file

@ -385,8 +385,10 @@ References.prototype.tokenHandler = function(manager, pipelineOpts, refsTok, cb)
}); });
}; };
References.prototype.extractRefFromNode = function(node, refsData, var _processRefs;
refInRefProcessor, referencesAboutId, referencesGroup, nestedRefsHTML) {
References.prototype.extractRefFromNode = function(node, refsData, cite,
referencesAboutId, referencesGroup, nestedRefsHTML) {
var nestedInReferences = referencesAboutId !== undefined; var nestedInReferences = referencesAboutId !== undefined;
var dp = DU.getDataParsoid(node); var dp = DU.getDataParsoid(node);
// SSS FIXME: Need to clarify semantics here. // SSS FIXME: Need to clarify semantics here.
@ -407,7 +409,7 @@ References.prototype.extractRefFromNode = function(node, refsData,
if (dp.hasRefInRef) { if (dp.hasRefInRef) {
var html = DU.ppToDOM(content); var html = DU.ppToDOM(content);
refInRefProcessor(html); _processRefs(cite, refsData, html);
content = DU.ppToXML(html, { innerXML: true }); content = DU.ppToXML(html, { innerXML: true });
} }
@ -637,9 +639,7 @@ References.prototype.serialHandler = {
* <references> <ref>foo</ref> </references> * <references> <ref>foo</ref> </references>
* <references> <ref>bar</ref> </references> * <references> <ref>bar</ref> </references>
* -------------------------------------------- */ * -------------------------------------------- */
var _processRefs, _processRefsInReferences; var _processRefsInReferences = function(cite, refsData, node, referencesId,
_processRefsInReferences = function(cite, refsData, node, referencesId,
referencesGroup, nestedRefsHTML) { referencesGroup, nestedRefsHTML) {
var child = node.firstChild; var child = node.firstChild;
while (child !== null) { while (child !== null) {
@ -647,8 +647,7 @@ _processRefsInReferences = function(cite, refsData, node, referencesId,
if (DU.isElt(child)) { if (DU.isElt(child)) {
var typeOf = child.getAttribute('typeof'); var typeOf = child.getAttribute('typeof');
if ((/(?:^|\s)mw:Extension\/ref\/Marker(?=$|\s)/).test(typeOf)) { if ((/(?:^|\s)mw:Extension\/ref\/Marker(?=$|\s)/).test(typeOf)) {
cite.references.extractRefFromNode(child, refsData, cite.references.extractRefFromNode(child, refsData, cite,
_processRefs.bind(null, cite, refsData),
referencesId, referencesGroup, nestedRefsHTML); referencesId, referencesGroup, nestedRefsHTML);
} else if (child.hasChildNodes()) { } else if (child.hasChildNodes()) {
_processRefsInReferences(cite, refsData, _processRefsInReferences(cite, refsData,
@ -667,8 +666,7 @@ _processRefs = function(cite, refsData, node) {
if (DU.isElt(child)) { if (DU.isElt(child)) {
var typeOf = child.getAttribute('typeof'); var typeOf = child.getAttribute('typeof');
if ((/(?:^|\s)mw:Extension\/ref\/Marker(?=$|\s)/).test(typeOf)) { if ((/(?:^|\s)mw:Extension\/ref\/Marker(?=$|\s)/).test(typeOf)) {
cite.references.extractRefFromNode(child, refsData, cite.references.extractRefFromNode(child, refsData, cite);
_processRefs.bind(null, cite, refsData));
} else if ((/(?:^|\s)mw:Extension\/references(?=$|\s)/).test(typeOf)) { } else if ((/(?:^|\s)mw:Extension\/references(?=$|\s)/).test(typeOf)) {
var referencesId = child.getAttribute("about"); var referencesId = child.getAttribute("about");
var referencesGroup = DU.getDataParsoid(child).group; var referencesGroup = DU.getDataParsoid(child).group;