From d8f4a31efe02d15acefcb2c9b20be39059042e6f Mon Sep 17 00:00:00 2001 From: Subramanya Sastry Date: Mon, 6 Aug 2018 23:31:53 -0500 Subject: [PATCH] Handle without crashing * Fixes rt regressions on svwiki:Havre and a bunch of other titles. Change-Id: I1d31ccf1045ba5a4fef9377101ad4e90a534c1e9 --- lib/ext/Cite/index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/ext/Cite/index.js b/lib/ext/Cite/index.js index 2bb3b481a..6c6e8726b 100644 --- a/lib/ext/Cite/index.js +++ b/lib/ext/Cite/index.js @@ -377,6 +377,7 @@ References.prototype.toDOM = function(state, content, args) { var frag = createReferences(state.manager.env, doc.body, refsOpts, function(dp) { dp.src = state.extToken.getAttribute('source'); + dp.selfClose = state.extToken.dataAttribs.selfClose; }); doc.body.appendChild(frag); @@ -526,10 +527,12 @@ References.prototype.insertReferencesIntoDOM = function(refsNode, refsData, nest dataMw.autoGenerated = true; } else if (nestedRefsHTML.length > 0) { dataMw.body = { 'html': '\n' + nestedRefsHTML.join('') }; - } else if (dataMw.body === null) { - // Is this correct? + } else if (!dp.selfClose) { + dataMw.body = { 'html': '' }; + } else { dataMw.body = undefined; } + dp.selfClose = undefined; } var refGroup = refsData.getRefGroup(group);