Re: [DOMCore] minor wording problem for Document.importNode()

On Thu, Jun 30, 2011 at 11:32 AM, Anne van Kesteren <annevk@opera.com> wrote:
> Should we support cloning Document and DocumentType objects? (There's an
> "<!--XXX wrong? -->" comment in the source.)

IMO it would be useful.  For instance, a while ago I was writing
test-cases that involved doing something to an iframe, checking if it
was expected, and then resetting it for the next test.  Resetting the
src of the iframe and repeatedly having to hit the network was really
slow (I didn't happen to have caching headers served), so my immediate
inclination was to clone the iframe's Document, then set it directly
using DOM methods after every test.  This proved to be unnecessarily
annoying, partly because I couldn't clone either the Document or the
DocumentType inside it.  I wound up making a DocumentFragment, copying
everything there but the doctype, and then having special logic for
restoring the doctype separately from the other nodes.

Received on Thursday, 30 June 2011 20:50:31 UTC