GWicke has uploaded a new change for review.

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


Change subject: Fix handleLinkNeighbors return value
......................................................................

Fix handleLinkNeighbors return value

handleLinkNeighbors returned the next node even if no siblings were consumed
for the tail, which caused further processing (unpackDOMFragments currently)
to be skipped for this node.

This broke parsing for

"[[Foo|<math>bar</math>]] [[Bar]]"

This patch makes sure that handleLinkNeighbours only returns the next node to
process if tail nodes were actually consumed. This fixes semantic errors on
en:Richter's_scale without adding an additional DOM pass as implemented in
alternative patch I369de325b79c85317a95869ddc10e1a0884b1ef6.

Change-Id: I8575676fef28a99435745378b62ef0a64f55210b
---
M js/lib/mediawiki.DOMPostProcessor.js
1 file changed, 3 insertions(+), 2 deletions(-)


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

diff --git a/js/lib/mediawiki.DOMPostProcessor.js 
b/js/lib/mediawiki.DOMPostProcessor.js
index 29e87cc..257a36d 100644
--- a/js/lib/mediawiki.DOMPostProcessor.js
+++ b/js/lib/mediawiki.DOMPostProcessor.js
@@ -2625,7 +2625,7 @@
                }
        }
 
-       if ( trail && trail.content ) {
+       if ( trail && trail.content && trail.content.length ) {
                for ( ix = 0; ix < trail.content.length; ix++ ) {
                        node.appendChild( trail.content[ix] );
                }
@@ -2636,8 +2636,9 @@
                                dp.dsr[3] += trail.src.length;
                        }
                }
+               // indicate that the node's tail siblings have been consumed
+               return node.nextSibling;
        }
-       return node.nextSibling; // indicate that node's siblings have been 
mutated
 }
 
 /**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8575676fef28a99435745378b62ef0a64f55210b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: GWicke <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to