Rename DU.serializeChilden to DU.serializeToXML

* And use it where appropriate.  This has the effect of reducing the
   dom size because of the use of smartQuote (see all the parserTests /
   blacklist changes).

 * The serializeChildren name clashes with the one in the
   serializeState, causing confusion and making grepping harder.

 * Bonus: removed some dsr info in parserTests and fixed a html2wt typo
   that was prevented a test from running.

Change-Id: I287f1efd4afe06b158844e0de9f16494d4a89f93
This commit is contained in:
Arlo Breault 2016-04-12 11:48:37 -07:00
parent 126ed00d40
commit 87296241d5

View file

@ -68,7 +68,7 @@ Ref.prototype.tokenHandler = function(manager, pipelineOpts, refTok, cb) {
da.stx = undefined;
da.group = refOpts.group || '';
da.name = refOpts.name || '';
da.content = contentBody ? DU.serializeChildren(contentBody) : '';
da.content = contentBody ? DU.serializeToXML(contentBody) : '';
da.hasRefInRef = contentBody ? hasRef(contentBody) : false;
toks.push(new SelfclosingTagTk('meta', [
new KV('typeof', 'mw:Extension/ref/Marker'),
@ -119,7 +119,7 @@ Ref.prototype.serialHandler = {
bodyElt = env.page.editedDoc.getElementById(dataMw.body.id);
}
if (bodyElt) {
html = bodyElt.innerHTML;
html = DU.serializeToXML(bodyElt);
} else {
// Some extra debugging for VisualEditor
var extraDebug = '';
@ -367,7 +367,7 @@ References.prototype.tokenHandler = function(manager, pipelineOpts, refsTok, cb)
emptyContentCB: emitReferencesFragment,
endCB: emitReferencesFragment,
documentCB: function(refsDoc) {
emitReferencesFragment([], DU.serializeChildren(refsDoc.body));
emitReferencesFragment([], DU.serializeToXML(refsDoc.body));
},
});
};
@ -398,7 +398,7 @@ References.prototype.extractRefFromNode = function(node, refsData,
// Save data attribs for the nested DOM
// since we are serializing it to a string.
DU.saveDataAttribsForDOM(html);
content = DU.serializeChildren(html);
content = DU.serializeToXML(html);
}
if (content) {
@ -474,7 +474,7 @@ References.prototype.extractRefFromNode = function(node, refsData,
} else {
DU.storeDataParsoid(span, dataParsoid);
DU.storeDataMw(span, dataMw);
refsInReferencesHTML.push(DU.serializeNode(span).str, '\n');
refsInReferencesHTML.push(DU.serializeToXML(span, true), '\n');
}
// Keep the first content to compare multiple <ref>s with the same name.
@ -678,11 +678,7 @@ _processRefs = function(cite, refsData, node) {
var captionDOM = DU.parseHTML(caption);
_processRefs(cite, refsData, captionDOM.body);
DU.saveDataAttribsForDOM(captionDOM.body);
// FIXME: We do this in a lot of places with embedded HTML,
// but, should we be running the XML-serializer on it?
// Once again, this is a generic cleanup to be done unrelated
// to this patch.
dmw.caption = captionDOM.body.innerHTML;
dmw.caption = DU.serializeToXML(captionDOM.body);
}
}
if (child.childNodes.length > 0) {