mediawiki-extensions-Visual.../modules/ve/dm
Catrope 7bcf35e0e8 (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
2012-12-22 12:27:11 +01:00
..
annotations (bug 42298) Handle URL encoding in MWInternalLinkAnnotation 2012-12-07 12:34:17 -08:00
nodes (bug 42806) Copy/paste errors on unbalanced data 2012-12-07 13:34:28 -08:00
ve.dm.Annotation.js Only apply HTML attributes to DOM nodes that are "safe" 2012-11-27 14:34:29 -08:00
ve.dm.AnnotationFactory.js Standards: Fix global variables and pass JSHint. 2012-10-23 00:53:48 +02:00
ve.dm.BranchNode.js Store the data model element in the DM tree 2012-11-27 14:36:29 -08:00
ve.dm.Converter.js (bug 43056) Inline tags like <span> are block-alienated sometimes 2012-12-22 12:27:11 +01:00
ve.dm.Document.js (bug 42925) Inspector doesn't open properly 2012-12-10 16:48:13 -08:00
ve.dm.DocumentSlice.js Fix typo'ed documentation issue with gerrit change 38009 2012-12-10 18:34:37 -08:00
ve.dm.DocumentSynchronizer.js DocumentSynchronizer fix and cleanup 2012-10-25 11:02:58 -07:00
ve.dm.js New annotation API: Annotation and AnnotationFactory classes 2012-10-12 15:07:02 -07:00
ve.dm.LeafNode.js Store the data model element in the DM tree 2012-11-27 14:36:29 -08:00
ve.dm.Node.js Fix rebase artefact in ve.dm.Node.getAttributes() 2012-11-28 11:20:54 -08:00
ve.dm.NodeFactory.js (bug 42806) Copy/paste errors on unbalanced data 2012-12-07 13:34:28 -08:00
ve.dm.Surface.js Added disable/enable methods to ve.Surface 2012-12-11 16:28:39 -08:00
ve.dm.SurfaceFragment.js Improve truncate and truncateRange to allow negative values 2012-12-11 11:10:22 -08:00
ve.dm.Transaction.js Static composition of 'can' and 'not', may improve performance slightly 2012-12-07 13:38:00 -08:00
ve.dm.TransactionProcessor.js Static composition of 'can' and 'not', may improve performance slightly 2012-12-07 13:38:00 -08:00