jenkins-bot has submitted this change and it was merged. Change subject: (bug 43056) Inline tags like <span> are block-alienated sometimes ......................................................................
(bug 43056) Inline tags like <span> are block-alienated sometimes This happens when the <span> is the start of unwrapped content. The converter logic to look at the tag name in wrapping mode doesn't kick in because we're not yet in wrapping mode at that point. The core issue was that previously, we relied on the document structure/state to choose between alienBlock and alienInline, and only used the tag name where the document structure was ambiguous (wrapping). Changed this to be the other way around: we now rely primarily on the tag name, and if that doesn't match what we expect based on the document structure, we work around that if possible. Specifically: * inline tag in our wrapper --> inline alien * block tag in our wrapper --> close wrapper, block alien * inline tag in wrapper that's not ours --> inline alien * block tag in wrapper that's not ours --> *inline* alien * inline tag in structural location --> open wrapper, inline alien * block tag in structural location --> block alien * inline tag in content location --> inline alien * block tag in content location --> *inline* alien only in the fourth and the last case do we need to use the "wrong" alien type to preserve document validity, and it will always be inline where block was expected, which should reduce UI issues. The condensed version of the above, which is used in the code, is: * If in a non-wrapper content location, use inline * If in a wrapper that's not ours, use inline * Otherwise, decide based on tag name * Open or close wrapper if needed ve.dm.Converter: * Replace isInline logic in createAlien() with the above * Factor out code to start wrapping (was duplicated) into startWrapping() * Call startWrapping() if createAlien() returns an alienInline and we're in a structural location Tests: * Add test cases with aliens at the start and end of unwrapped content ** The first one failed prior to these changes and now passes, the second one was already passing * Fix about group test case, was exhibiting the bug that this commit fixes Change-Id: I657aa0ff5bc2b57cd48ef8a99c8ca930936c03b8 --- M modules/ve/dm/ve.dm.Converter.js M modules/ve/test/dm/ve.dm.Converter.test.js M modules/ve/test/dm/ve.dm.example.js 3 files changed, 75 insertions(+), 31 deletions(-) Approvals: Trevor Parscal: Looks good to me, approved jenkins-bot: Verified -- To view, visit https://gerrit.wikimedia.org/r/39846 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I657aa0ff5bc2b57cd48ef8a99c8ca930936c03b8 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Catrope <[email protected]> Gerrit-Reviewer: Catrope <[email protected]> Gerrit-Reviewer: Trevor Parscal <[email protected]> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
