Stable element ID assignments would be desirable for many use cases:
- Stable links to sections.
- A modern alternative for Labeled Section Transclusion (see T100139)
- Annotations like blame maps.
- Fine-grained dependency tracking for change propagation.
- Content section tracking for translations: T90187
We have been discussing ways to implement stable IDs for a while now, but haven't found the time to really flesh out a plan yet.
Idea 1): Leverage DOM diffing to transfer IDs for unmodified content
After each parse, DOM-diff against the previous revision. For all unchanged content, transfer the old element ID assignments.
Issues:
- Our DOM diff algorithm is not very sophisticated. For example, it lacks move detection. However, move detection could be added (using the xydiff algorithm or some tricks from hypothesis, for example), which would also improve selective serialization and possible future blame map generation.