domino icon indicating copy to clipboard operation
domino copied to clipboard

document.open/write/close

Open gagern opened this issue 9 years ago • 1 comments

While trying to get GWT-compiled code to execute in a domino environment, I noticed that it attempts to perform an open/write/close cycle on a document, which isn't (properly) supported by domino:

domino = require("domino");
html = "<!DOCTYPE html><html><head></head><body></body></html>";
document = domino.createDocument(html);
console.log(!!document.body); // prints true
document.open();
document.write(html);
document.close();
console.log(!!document.body); // prints false

It would seem that even if document.write during page load is unsupported, it should be possible to support the above, e.g. by caching all content received during write and parsing it during close.

gagern avatar Mar 23 '16 14:03 gagern

Patches welcome, of course, but I don't expect to really support document.open/document.write. As you note, handling the special case where document.open is called on an empty document would be an interesting hack.

We actually conform very very closely to the HTML parsing spec, so in theory the open/write/close behavior isn't completely unimplemented. But it's a rather unusual case, and generally discouraged when writing new code.

cscott avatar Mar 23 '16 16:03 cscott