Create custom document object:
var doc = document.implementation.createDocument(
'http://www.w3.org/1999/xhtml',
'html',
//Inherit current doctype
document.doctype
);
Try to write in it:
//Throws error - TypeError: doc.write is not a function
doc.write(document.documentElement.innerHTML);
Same goes for .close and .open. What the hell? Is this a bug? Probably not - all browsers do it:
Chrome (most helful error ever, Chrome must be fun to debug in):
Uncaught TypeError: undefined is not a function
Opera:
TypeError: Object #<Document> has no method 'write'
Firefox:
TypeError: document.implementation.createDocument(...).write is not a function
Why are the methods open, write and close missing for custom documents?
.write,.openand.closeare horrible methods and should not be used?doc?window.document. I'm trying to loadnextandpreviouscomics using AJAX and preload them so that I don't have to wait... :)