This lets the embedder choose which Document object to use for creating elements, adding event listeners, etc. The reason this exists is because when working with multiple windows it can be convenient to create all elements under the primary window to make instanceof usage consistent. See microsoft/vscode#195595