For HTML documents, `createFromDocumentRoot` would normally never throw an error, since the root element for an HTML document is always `HTMLHtmlElement`, however, for any non-empty XML document, the root element is not any specific type. This caused `createFromDocumentRoot` to throw an error in the context menu.
Differential Revision: https://phabricator.services.mozilla.com/D222621