Class com.gargoylesoftware.htmlunit.javascript.host.dom.DOMImplementation should implement function createHTMLDocument according to this spec:
https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument
I tried to implement patch, but it is impossible to create HtmlPage not connected with any window (such page is needed in case of creation of HTMLDocument using mentioned missing function).
Unit tests for createHTMLDocument function
Attempt of implementation
Hi Adam,
have added a first rough implementation based on your patch.
The creation of a Page without a window seems to be more tricky because large parts of the code rely on the associated window.
Any futher patches are welcome.
Thanks for your support.
Last edit: RBRi 2016-11-20
Such script should be possible to execute:
var doc = window.document.implementation.createHTMLDocument('inert'); var p = doc.createElement('p'); p.innerHTML = 'test';
but there is NPE in SimpleScriptable.
Patch in attachment.
We now support the usual cases and our test suite has some tests for different scenarios.
Please open a new issue if you still facing problems with this impl.