Arlolra has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/88927


Change subject: Move set creation outside function call
......................................................................

Move set creation outside function call

Removes at least 75% of the regression to parserTests from the es6
shim.

Change-Id: I4a0bf03fe95f43a6fc8e480a655adf865f71e48a
---
M js/lib/dom.migrateTrailingNLs.js
1 file changed, 15 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Parsoid 
refs/changes/27/88927/1

diff --git a/js/lib/dom.migrateTrailingNLs.js b/js/lib/dom.migrateTrailingNLs.js
index 5d66656..f07cb56 100644
--- a/js/lib/dom.migrateTrailingNLs.js
+++ b/js/lib/dom.migrateTrailingNLs.js
@@ -3,6 +3,21 @@
 var DU = require('./mediawiki.DOMUtils.js').DOMUtils,
        JSUtils = require('./jsutils.js').JSUtils;
 
+
+// These nodes either end a line in wikitext (tr, li, dd, ol, ul, dl, caption,
+// p) or have implicit closing tags that can leak newlines to those that end a
+// line (th, td)
+//
+// SSS FIXME: Given condition 2, we may not need to check th/td anymore
+// (if we can rely on auto inserted start/end tags being present always).
+var nodesToMigrateFrom = JSUtils.arrayToSet([
+       "TH", "TD", "TR", "LI", "DD", "OL", "UL", "DL", "CAPTION", "P"
+]);
+
+function nodeEndsLineInWT(node) {
+       return nodesToMigrateFrom.has( node.nodeName ) && 
!DU.isLiteralHTMLNode( node );
+}
+
 function migrateTrailingNLs(elt, env) {
 
        // We can migrate a newline out of a node if one of the following is 
true:
@@ -11,19 +26,6 @@
        // (3) It is the rightmost node in the DOM subtree rooted at a node
        //     that ends a line in wikitext
        function canMigrateNLOutOfNode(node) {
-               // These nodes either end a line in wikitext (tr, li, dd, ol, 
ul, dl, caption, p)
-               // or have implicit closing tags that can leak newlines to 
those that end a line (th, td)
-               //
-               // SSS FIXME: Given condition 2, we may not need to check th/td 
anymore
-               // (if we can rely on auto inserted start/end tags being 
present always).
-               var nodesToMigrateFrom = JSUtils.arrayToSet([
-                       "TH", "TD", "TR", "LI", "DD", "OL", "UL", "DL", 
"CAPTION", "P"
-               ]);
-
-               function nodeEndsLineInWT(node) {
-                       return nodesToMigrateFrom.has( node.nodeName ) && 
!DU.isLiteralHTMLNode( node );
-               }
-
                return node && (
                        nodeEndsLineInWT(node) ||
                        (DU.isElt(node) && DU.getDataParsoid( node 
).autoInsertedEnd) ||

-- 
To view, visit https://gerrit.wikimedia.org/r/88927
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4a0bf03fe95f43a6fc8e480a655adf865f71e48a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: Arlolra <abrea...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to