The data->DOM converter should construct its DOM bottom-up, the way https://gerrit.wikimedia.org/r/74058 already does for annotations. This would enable us to do some cool things like:
- Pass childDomElements to nodes and meta items (already done for annotations)
- Pass data content in addition to DOM content?
- Allow nodes and meta items to unwrap themselves by returning an empty array (already done for annotations)
- We could implement unwrapping of generated wrapper paragraphs using this feature
- Possibly change the API so that instead of returning an array of DOM elements, the toDomElements function is responsible for appending its children.
- This could replace handlesOwnChildren, and enable model types with complex output
For DOM->data it's not as straightforward. We could experiment with bottom-up (outside-in, really) building there too, but it would be a bit less clear how things would work, and whether the copying involved would affect performance (although I believe we may already do a fair bit of copying around as it is).
This may be my pet project for my flight to Wikimania, or I may end up doing this sooner if there's time.
Version: unspecified
Severity: enhancement