Subramanya Sastry has uploaded a new change for review. https://gerrit.wikimedia.org/r/114651
Change subject: Renamed function name for clarity + added documentation. ...................................................................... Renamed function name for clarity + added documentation. * Added documentation to buildDOMFragmentTokens and the options that affect this. Change-Id: I7eccfd3f4dc5b4b91d20d1d24d98ec514df6dfbc --- M lib/ext.Cite.js M lib/ext.core.DOMFragmentBuilder.js M lib/ext.core.TemplateHandler.js M lib/mediawiki.DOMUtils.js 4 files changed, 42 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid refs/changes/51/114651/1 diff --git a/lib/ext.Cite.js b/lib/ext.Cite.js index 2b7c560..021a555 100644 --- a/lib/ext.Cite.js +++ b/lib/ext.Cite.js @@ -304,7 +304,7 @@ cb({ async: false, - tokens: DU.buildDOMFragmentForTokenStream( + tokens: DU.buildDOMFragmentTokens( refsTok, olHTML, manager.env, diff --git a/lib/ext.core.DOMFragmentBuilder.js b/lib/ext.core.DOMFragmentBuilder.js index a1f13d1..842d846 100644 --- a/lib/ext.core.DOMFragmentBuilder.js +++ b/lib/ext.core.DOMFragmentBuilder.js @@ -93,7 +93,7 @@ }; DOMFragmentBuilder.prototype.wrapDOMFragment = function(cb, scopeToken, dom) { - var toks = DU.buildDOMFragmentForTokenStream(scopeToken, dom, this.manager.env); + var toks = DU.buildDOMFragmentTokens(scopeToken, dom, this.manager.env); // Nothing more to send cb after this cb({tokens: toks, async:false}); diff --git a/lib/ext.core.TemplateHandler.js b/lib/ext.core.TemplateHandler.js index da9b2c8..7ec06e3 100644 --- a/lib/ext.core.TemplateHandler.js +++ b/lib/ext.core.TemplateHandler.js @@ -727,7 +727,7 @@ )); }; - var toks = DU.buildDOMFragmentForTokenStream( + var toks = DU.buildDOMFragmentTokens( state.token, doc, this.manager.env, diff --git a/lib/mediawiki.DOMUtils.js b/lib/mediawiki.DOMUtils.js index 183362d..c72ffec 100644 --- a/lib/mediawiki.DOMUtils.js +++ b/lib/mediawiki.DOMUtils.js @@ -1501,8 +1501,46 @@ * * The DOMPostProcessor will unpack the fragment and insert the HTML * back into the DOM. + * + * @param {Object} token + * The token that generated the DOM. + * + * @param {Object} docOrHTML + * The DOM (or HTML string) that the token expanded to. + * + * @param {Object} env + * The active environment/context. + * + * @param {Object} addAttrsCB + * Callback that adds additional attributes to the generated tokens. + * + * @param {Object} opts + * Options to be passed onto the encapsulation code + * + * aboutId : The about-id to set on the generated tokens. + * + * noAboutId : If true, an about-id will not be added to the tokens + * if an aboutId is not provided. + * Ex: <figure> + * + * tsr : The TSR to set on the generated tokens. This TSR is + * used to compute DSR on the placeholder tokens. + * The computed DSR is transferred over to the unpacked DOM + * if setDSR is true (see below). + * + * setDSR : When the DOM-fragment is unpacked, this option governs + * whether the DSR from the placeholder node is transferred + * over to the unpacked DOM or not. + * Ex: Cite, reused transclusions + * + * isForeignContent : + * Does the DOM come from outside the main page? This governs + * how the encapsulation ids are assigned to the unpacked DOM. + * Ex: transclusions, extensions -- all siblings get the same + * about id. This is not true for <figure> HTML. + * */ - buildDOMFragmentForTokenStream: function(token, docOrHTML, env, addAttrsCB, opts) { + buildDOMFragmentTokens: function(token, docOrHTML, env, addAttrsCB, opts) { var doc = docOrHTML.constructor === String ? this.parseHTML(docOrHTML) : docOrHTML; var nodes = doc.body.childNodes; -- To view, visit https://gerrit.wikimedia.org/r/114651 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7eccfd3f4dc5b4b91d20d1d24d98ec514df6dfbc Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/services/parsoid Gerrit-Branch: master Gerrit-Owner: Subramanya Sastry <ssas...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits