Probably better that I describe with snippets, since the translator code is more convoluted than it should be.
The translator acquires serialized HTML from an API endpoint documented here:
The translation then builds a FOM document with createDocument(), with a base element as mentioned on importFromDocument().
The DOM object is then fed to the item in the usual way:
item.attachments.push({
document: newDoc,
snapshot: true
})
The document has no location.href, and I think that may be why it is stripped out. In attachments.js, there is still and attachment, but it is no longer xmlDocument, and the attachment fails.
This used to work in MLZ/Juris-M, but I seem to remember hacking on the original code to get it going. Some messy hacks that looked fragile were left behind in the 5.0 migration, that was probably one of them.