Page MenuHomePhabricator

Rewrite VisualEditor's converter to be bottom-up
Open, LowPublic40 Estimated Story PointsFeature

Description

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

Details

Reference
bz51501

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 2:06 AM
bzimport added a project: Technical-Debt.
bzimport set Reference to bz51501.

(In reply to comment #0)

  • 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

This would also enable partial unwrapping of annotations, e.g. <p><a> Foo </a></p> -> <p> <a>Foo</a> </p>

Jdforrester-WMF lowered the priority of this task from High to Medium.Feb 24 2015, 10:14 PM
Jdforrester-WMF lowered the priority of this task from Medium to Low.Apr 15 2015, 6:16 PM
Jdforrester-WMF renamed this task from VisualEditor: Rewrite converter to be bottom-up to Rewrite VisualEditor's converter to be bottom-up.Sep 16 2015, 11:48 PM
Jdforrester-WMF removed Esanders as the assignee of this task.
Aklapper changed the subtype of this task from "Task" to "Feature Request".Feb 4 2022, 11:13 AM
Aklapper removed a subscriber: TrevorParscal.