mediawiki-extensions-Visual.../modules/ve/dm
Catrope 085a6f0985 (bug 42487) Don't crash the converter for "<span>\n<p>Foo</p></span>"
The converter was misbehaving when handling <p>s inside <span>s. This
can't be expressed in the linmod, but it would try to anyway. <span><p>
would result in too many paragraph closing elements, leading to an
exception in ve.dm.Document complaining about unbalanced input.
<span>\n<p> would result in an exception in the converter itself while
trying to perform whitespace preservation on the newline.

This change makes the converter detect these scenarios and alienate the
offending node. So <span><p>Foo</p></span> converts to a wrapper
paragraph containing an alienInline whose HTML is "<p>Foo</p>" and which
is annotated with a TextStyleSpanAnnotation.

ve.dm.Converter.getDomFromData():
* Change the criteria for alienBlock vs alienInline
** Only infer from the node type if we're in wrapping mode AND we're at
   the same level where the wrapping started (wrappingIsOurs). If the
   latter isn't the case, we can't split the wrapper in the block case
   because we're at the wrong level.
** Use alienInline not only if the branch is a content branch, but also
   if there are active annotations. This catches e.g. <li><b><p>
   (and generally <span><p> on the top level).
* Before converting a child element, check that the child isn't "bad".
  Bad children are non-content children in content branches, and
  non-content children encountered within a wrapper that we can't split.
  Only good children are converted, and bad children are alienated (cue
  Santa/Sinterklaas jokes).
* Add childIsContent and rename branchIsContent to branchHasContent

Change-Id: If420ae80ab0777424a9a5517335ef9d0170e87ae
2012-12-05 17:20:07 -08:00
..
annotations (bug 42140) Don't force spaces to underscores in internal links 2012-11-19 18:55:49 -08:00
nodes Store the data model element in the DM tree 2012-11-27 14:36:29 -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 42487) Don't crash the converter for "<span>\n<p>Foo</p></span>" 2012-12-05 17:20:07 -08:00
ve.dm.Document.js (bug 42401) Cursor movement fixes 2012-11-30 09:50:47 -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 Flag pre nodes as having significant whitespace 2012-11-07 12:10:58 -08:00
ve.dm.Surface.js (bug 40339) Out of bounds errors 2012-12-03 14:23:58 -08:00
ve.dm.SurfaceFragment.js (bug 42401) Cursor movement fixes 2012-11-30 09:50:47 -08:00
ve.dm.Transaction.js Merge "Added contextChange event to surface model, replacing annotationChange" 2012-11-27 22:54:11 +00:00
ve.dm.TransactionProcessor.js Make annotating inline elements actually work 2012-11-27 14:41:40 -08:00