Fix DOMImplementation should be linked to the Document

This fixes issues 2230.