Page MenuHomePhabricator

Only omit auto-closed end tags from serialization if auto-closing context is unchanged
Closed, ResolvedPublic

Description

We now mark TreeBuilder- and QuoteTransformer-closed elements with the autoInsertedEnd flag in data-parsoid. The serializer then omits those end tags from serialization.

Currently the serializer does this unconditionally, even if the auto-closing context has changed as in this example:

{|

''italic
}

The DOM produced includes an </i> tag. An editor can append content to the table cell after the italic content, which would then wrongly be included in the italic element after serialization:

{|

''italic new non-italic content
}

The serializer needs to be smarter about these context changes, and should emit the close tag when needed. In this case, the correct result would be:

{|

''italic'' new non-italic content
}

Version: unspecified
Severity: normal

Details

Reference
bz42248

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 12:45 AM
bzimport set Reference to bz42248.

We have pretty much solved this with two changes:

  • Selective serialization is finer-grained based on our own DOM diff. This hides diffs from auto-inserted end tags in unmodified content.
  • Auto-inserted end tag markers are only used in round-trip testing, where doing so is safe. This means that auto-inserted end tags are explicitly serialized when that part of the content was modified. Since this tends to be local the diff will still be readable.