See https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec/Rich_Attributes
In phase 1b of this work, support for live DocumentFragments is added, which are stored in a <template> bank and serialized -- initially as inline HTML with the <template>s stripped, but optionally/in the future as references to <template> ids.
After the infrastructure is present, the following bits can be converted to the use of the rich attribute mechanisms (see DOMTraverser and ContentUtils::processAttributeEmbeddedHTML):
- the data-mw-variant attribute
- expanded attributes
- inline media (inside data-mw attribute)
- "extension specific embedded HTML"