[Stable element ID assignments](https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec/Element_IDs) 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.
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.
- 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](https://github.com/hypothesis/dom-anchor-text-quote), for example), which would also improve selective serialization and possible future blame map generation.
## See also
- [Original design document on the wiki](https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec/Element_IDs)